1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

re-add reload-method as an alias for reload-code

Turns out some people actually used reload-method, so we re-add it to avoid them getting angry
This commit is contained in:
John Mair 2013-01-28 22:51:05 +01:00
parent 4afb8d34a1
commit 2e40eb24c6
4 changed files with 14 additions and 2 deletions

View file

@ -36,4 +36,5 @@ class Pry
end
Pry::Commands.add_command(Pry::Command::ReloadCode)
Pry::Commands.alias_command 'reload-method', 'reload-code'
end

View file

@ -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]

View file

@ -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

View file

@ -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,