Skip to content

Instantly share code, notes, and snippets.

@palkan
Created April 22, 2015 08:20
Show Gist options
  • Save palkan/7f50407612fb351eab08 to your computer and use it in GitHub Desktop.
Save palkan/7f50407612fb351eab08 to your computer and use it in GitHub Desktop.
Pry $LOAD_PATH hook
# add the current directories /lib and /spec directories to the path if they exist
Pry.config.hooks.add_hook(:before_session, :load_path) do
dir = `pwd`.chomp
%w(lib spec test).map{ |d| "#{dir}/#{d}" }.each { |p| $: << p unless !File.exist?(p) || $:.include?(p) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment