pry 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/lib/pry/commands.rb +12 -8
- data/lib/pry/version.rb +1 -1
- metadata +2 -2
data/CHANGELOG
CHANGED
data/lib/pry/commands.rb
CHANGED
@@ -76,18 +76,22 @@ class Pry
|
|
76
76
|
end
|
77
77
|
|
78
78
|
command "show_method", "Show sourcecode for method <methname>." do |meth_name|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
79
|
+
context_meth_name = target.eval("__method__")
|
80
|
+
meth_name = context_meth_name if !meth_name
|
81
|
+
|
82
|
+
# fragile as it hard-codes in the __binding_impl__ method name
|
83
|
+
# from core_extensions.rb
|
84
|
+
if meth_name && meth_name != :__binding_impl__
|
85
|
+
code = target.eval("method(\"#{meth_name.to_s}\")").source
|
86
|
+
output.puts code
|
87
|
+
next
|
85
88
|
end
|
89
|
+
output.puts "Error: Not in a method."
|
86
90
|
end
|
87
91
|
|
88
92
|
command "show_imethod", "Show sourcecode for instance method <methname>." do |meth_name|
|
89
|
-
|
90
|
-
output.puts
|
93
|
+
code = target.eval("instance_method(\"#{meth_name}\")").source
|
94
|
+
output.puts code
|
91
95
|
end
|
92
96
|
|
93
97
|
command "jump_to", "Jump to a Pry session further up the stack, exiting all sessions below." do |break_level|
|
data/lib/pry/version.rb
CHANGED