mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
version 0.4.5 fixed show_method command
This commit is contained in:
parent
d890d7b38d
commit
d0cf3ef153
3 changed files with 16 additions and 9 deletions
|
@ -1,3 +1,6 @@
|
|||
27/1/2010 version 0.4.5
|
||||
* fixed show_method (though fragile as it references __binding_impl__
|
||||
directly, making a name change to that method difficult
|
||||
27/1/2010 version 0.4.4
|
||||
* oops, added examples/ directory
|
||||
26/1/2010 version 0.4.3
|
||||
|
|
|
@ -76,18 +76,22 @@ class Pry
|
|||
end
|
||||
|
||||
command "show_method", "Show sourcecode for method <methname>." do |meth_name|
|
||||
if meth_name
|
||||
meth_name = target.eval("__method__").to_s if !meth_name
|
||||
doc = target.eval("method(\"#{meth_name}\")").source
|
||||
output.puts doc
|
||||
else
|
||||
output.puts "Error: Not in a method."
|
||||
context_meth_name = target.eval("__method__")
|
||||
meth_name = context_meth_name if !meth_name
|
||||
|
||||
# fragile as it hard-codes in the __binding_impl__ method name
|
||||
# from core_extensions.rb
|
||||
if meth_name && meth_name != :__binding_impl__
|
||||
code = target.eval("method(\"#{meth_name.to_s}\")").source
|
||||
output.puts code
|
||||
next
|
||||
end
|
||||
output.puts "Error: Not in a method."
|
||||
end
|
||||
|
||||
command "show_imethod", "Show sourcecode for instance method <methname>." do |meth_name|
|
||||
doc = target.eval("instance_method(\"#{meth_name}\")").source
|
||||
output.puts doc
|
||||
code = target.eval("instance_method(\"#{meth_name}\")").source
|
||||
output.puts code
|
||||
end
|
||||
|
||||
command "jump_to", "Jump to a Pry session further up the stack, exiting all sessions below." do |break_level|
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
class Pry
|
||||
VERSION = "0.4.4"
|
||||
VERSION = "0.4.5"
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue