Skip to content

Instantly share code, notes, and snippets.

@rwjblue
Created January 19, 2012 17:06
Show Gist options
  • Save rwjblue/1641209 to your computer and use it in GitHub Desktop.
Save rwjblue/1641209 to your computer and use it in GitHub Desktop.
Reload all ruby files in the given directory (defaults to Dir.pwd) that have been loaded.
Pry.config.commands.command "reload", "Reload all ruby files in the given directory (defaults to Dir.pwd) that have been loaded." do |*args|
args = [Dir.pwd] if args.empty?
$LOADED_FEATURES.each do |feature|
if args.any?{|dir| feature =~ /#{dir}/} && feature.end_with?('.rb')
load feature
output.puts "Reloaded: #{feature}."
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment