diff --git a/lib/pry/commands/reload_code.rb b/lib/pry/commands/reload_code.rb index db823910..fe815098 100644 --- a/lib/pry/commands/reload_code.rb +++ b/lib/pry/commands/reload_code.rb @@ -36,4 +36,5 @@ class Pry end Pry::Commands.add_command(Pry::Command::ReloadCode) + Pry::Commands.alias_command 'reload-method', 'reload-code' end diff --git a/lib/pry/commands/show_info.rb b/lib/pry/commands/show_info.rb index c23e1542..2789ba0e 100644 --- a/lib/pry/commands/show_info.rb +++ b/lib/pry/commands/show_info.rb @@ -23,9 +23,13 @@ class Pry if show_all_modules?(code_object) # show all monkey patches for a module + + @all_modules = true result = content_and_headers_for_all_module_candidates(code_object) else # show a specific code object + + @all_modules = false result = content_and_header_for_code_object(code_object) end @@ -34,7 +38,7 @@ class Pry end def content_and_header_for_code_object(code_object) - header(code_object) << content_for(code_object) + header(code_object) + content_for(code_object) end def content_and_headers_for_all_module_candidates(mod) @@ -120,6 +124,10 @@ class Pry end end + def all_modules? + @all_modules + end + def complete(input) if input =~ /([^ ]*)#([a-z0-9_]*)\z/ prefix, search = [$1, $2] diff --git a/lib/pry/commands/show_source.rb b/lib/pry/commands/show_source.rb index 0748d067..73356d2e 100644 --- a/lib/pry/commands/show_source.rb +++ b/lib/pry/commands/show_source.rb @@ -25,7 +25,6 @@ class Pry # The source for code_object prepared for display. def content_for(code_object) - raise CommandError, "Cannot locate source!" if !code_object.source Code.new(code_object.source, start_line_for(code_object)). with_line_numbers(use_line_numbers?).to_s end diff --git a/lib/pry/wrapped_module.rb b/lib/pry/wrapped_module.rb index aa978d17..6bbfb955 100644 --- a/lib/pry/wrapped_module.rb +++ b/lib/pry/wrapped_module.rb @@ -259,6 +259,10 @@ class Pry Pry::WrappedModule(sup) if sup end + def first_module_candidate_with_source + + end + private # @return [Pry::WrappedModule::Candidate] The candidate of rank 0,