pry 0.5.0pre2 → 0.5.0pre4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +26 -31
- data/examples/example_command_override.rb +1 -1
- data/examples/example_image_edit.rb +7 -8
- data/examples/example_input2.rb +1 -1
- data/lib/pry/commands.rb +110 -53
- data/lib/pry/version.rb +1 -1
- metadata +76 -38
data/README.markdown
CHANGED
@@ -13,7 +13,7 @@ session to your code (with Pry) instead of bringing your code to a
|
|
13
13
|
REPL session (as with IRB).
|
14
14
|
|
15
15
|
It is not based on the IRB codebase, and implements some unique REPL
|
16
|
-
commands such as `
|
16
|
+
commands such as `show-method`, `show-doc`, `ls` and `cd`
|
17
17
|
|
18
18
|
Pry is also fairly flexible and allows significant user
|
19
19
|
[customization](http://rdoc.info/github/banister/pry/master/file/wiki/Customizing-pry.md). It
|
@@ -121,9 +121,9 @@ command. E.g
|
|
121
121
|
=> nil
|
122
122
|
|
123
123
|
We can then jump back to any of the previous nesting levels by using
|
124
|
-
the `
|
124
|
+
the `jump-to` command:
|
125
125
|
|
126
|
-
pry("friend":3)>
|
126
|
+
pry("friend":3)> jump-to 1
|
127
127
|
Ending Pry session for "friend"
|
128
128
|
Ending Pry session for 100
|
129
129
|
=> 100
|
@@ -133,9 +133,9 @@ If we just want to go back one level of nesting we can of course
|
|
133
133
|
use the `quit` or `exit` or `back` commands.
|
134
134
|
|
135
135
|
To break out of all levels of Pry nesting and return immediately to the
|
136
|
-
calling process use `
|
136
|
+
calling process use `exit-all`:
|
137
137
|
|
138
|
-
pry("friend":3)>
|
138
|
+
pry("friend":3)> exit-all
|
139
139
|
Ending Pry session for "friend"
|
140
140
|
Ending Pry session for 100
|
141
141
|
Ending Pry session for Hello
|
@@ -163,8 +163,8 @@ end.
|
|
163
163
|
* Use `_pry_` to reference the Pry instance managing the current session.
|
164
164
|
* Pry supports tab completion.
|
165
165
|
* Pry has multi-line support built in.
|
166
|
-
* Pry has special commands not found in many other Ruby REPLs: `
|
167
|
-
`
|
166
|
+
* Pry has special commands not found in many other Ruby REPLs: `show-method`, `show-doc`
|
167
|
+
`jump-to`, `ls`, `cd`, `cat`
|
168
168
|
* Pry gives good control over nested sessions (important when exploring complicated runtime state)
|
169
169
|
* Pry is not based on the IRB codebase.
|
170
170
|
* Pry allows significant customizability.
|
@@ -183,7 +183,7 @@ invoke any of these methods directly depending on exactly what aspect of the fun
|
|
183
183
|
and so does not have an executable. It is designed to be used by
|
184
184
|
other programs, not on its own. For a full-featured `irb` replacement
|
185
185
|
see [ripl](https://github.com/cldwalker/ripl)
|
186
|
-
* Pry's `
|
186
|
+
* Pry's `show-method` and `show-doc` commands do not work
|
187
187
|
in Ruby 1.8.
|
188
188
|
|
189
189
|
Commands
|
@@ -229,35 +229,34 @@ whitespace in between.
|
|
229
229
|
|
230
230
|
If you want to access a method of the same name, prefix the invocation by whitespace.
|
231
231
|
|
232
|
-
* Typing `!` on a line by itself will
|
233
|
-
getting you out of a situation
|
234
|
-
goes wrong.
|
232
|
+
* Typing `!` on a line by itself will clear the input buffer - useful for
|
233
|
+
getting you out of a situation where the parsing process
|
234
|
+
goes wrong and you get stuck in an endless read loop.
|
235
235
|
* `status` shows status information about the current session.
|
236
|
+
* `version` Show Pry version information
|
236
237
|
* `help` shows the list of session commands with brief explanations.
|
237
238
|
* `exit` or `quit` or `back` will end the current Pry session and go
|
238
239
|
back to the calling process or back one level of nesting (if there
|
239
240
|
are nested sessions).
|
240
|
-
* `ls` returns a list of local variables
|
241
|
-
|
242
|
-
* `
|
243
|
-
* `
|
244
|
-
* `cat <var>` Calls `inspect` on `<var>`
|
245
|
-
* `cd <var>` Starts a `Pry` session on the variable <var>. E.g `cd @x`
|
241
|
+
* `ls [OPTIONS] [VAR]` returns a list of local variables, instance variables, and
|
242
|
+
methods, etc. Highly flexible. See `ls --help` for more info.
|
243
|
+
* `cat VAR` Calls `inspect` on `VAR`
|
244
|
+
* `cd VAR` Starts a `Pry` session on the variable VAR. E.g `cd @x`
|
246
245
|
(use `cd ..` to go back).
|
247
|
-
* `
|
248
|
-
|
249
|
-
* `
|
250
|
-
|
251
|
-
* `
|
252
|
-
* `show_idoc <methname>` Displays comments for instance
|
253
|
-
method `<methname>`
|
254
|
-
* `exit_program` or `quit_program` will end the currently running
|
246
|
+
* `show-method [OPTIONS] METH` Displays the sourcecode for the method
|
247
|
+
`METH`. E.g `show-method hello`. See `show-method --help` for more info.
|
248
|
+
* `show-doc [OPTIONS] METH` Displays comments for `METH`. See `show-doc
|
249
|
+
--help` for more info.
|
250
|
+
* `exit-program` or `quit-program` will end the currently running
|
255
251
|
program.
|
256
252
|
* `nesting` Shows Pry nesting information.
|
253
|
+
* `cat-file FILE` Displays the contents of a file on disk in the Pry session.
|
254
|
+
* `eval-file [OPTIONS] FILE` Evals a Ruby script at top-level or in
|
255
|
+
the current context. See `eval-file --help` for more info.
|
257
256
|
* `!pry` Starts a Pry session on the implied receiver; this can be
|
258
257
|
used in the middle of an expression in multi-line input.
|
259
|
-
* `
|
260
|
-
* `
|
258
|
+
* `jump-to NEST_LEVEL` Unwinds the Pry stack (nesting level) until the appropriate nesting level is reached.
|
259
|
+
* `exit-all` breaks out of all Pry nesting levels and returns to the
|
261
260
|
calling process.
|
262
261
|
* You can type `Pry.start(obj)` or `obj.pry` to nest another Pry session within the
|
263
262
|
current one with `obj` as the receiver of the new session. Very useful
|
@@ -308,7 +307,3 @@ Contact
|
|
308
307
|
-------
|
309
308
|
|
310
309
|
Problems or questions contact me at [github](http://github.com/banister)
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
@@ -27,7 +27,7 @@ class MyCommands < Pry::CommandBase
|
|
27
27
|
end
|
28
28
|
|
29
29
|
# bring in a few other commands
|
30
|
-
import_from Pry::Commands, "quit", "
|
30
|
+
import_from Pry::Commands, "quit", "show-method"
|
31
31
|
end
|
32
32
|
|
33
33
|
# Start a Pry session using the commands defined in MyCommands
|
@@ -31,23 +31,23 @@ class ImageCommands < Pry::CommandBase
|
|
31
31
|
exit
|
32
32
|
end
|
33
33
|
|
34
|
-
import_from Pry::Commands, "ls", "
|
34
|
+
import_from Pry::Commands, "ls", "!"
|
35
35
|
end
|
36
36
|
|
37
37
|
class WinClass < Gosu::Window
|
38
38
|
|
39
39
|
def initialize
|
40
40
|
super(WIDTH, HEIGHT, false)
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
@binding =
|
41
|
+
@img = TexPlay.create_image(self, 200, 200).clear :color => :black
|
42
|
+
@img.rect 0, 0, @img.width - 1, @img.height - 1
|
43
|
+
|
44
|
+
@binding = Pry.binding_for(@img)
|
45
45
|
|
46
46
|
@pry_instance = Pry.new(:commands => ImageCommands, :prompt => IMAGE_PROMPT)
|
47
47
|
end
|
48
48
|
|
49
49
|
def draw
|
50
|
-
|
50
|
+
@img.draw_rot(WIDTH / 2, HEIGHT / 2, 1, 0, 0.5, 0.5)
|
51
51
|
end
|
52
52
|
|
53
53
|
def update
|
@@ -57,7 +57,7 @@ class WinClass < Gosu::Window
|
|
57
57
|
# being updated; instead we do a REP session, and let the image
|
58
58
|
# update each time the user presses enter. We maintain the same
|
59
59
|
# binding object to keep locals between calls to `Pry#rep()`
|
60
|
-
|
60
|
+
@pry_instance.rep(@binding)
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
@@ -67,6 +67,5 @@ puts "Example: Try typing 'circle width/2, height/2, 95, :color => :blue, :fill
|
|
67
67
|
puts "If you want to save your image, type: save(\"img.png\")"
|
68
68
|
|
69
69
|
w = WinClass.new
|
70
|
-
Thread.new { Pry.start(w) }
|
71
70
|
w.show
|
72
71
|
|
data/examples/example_input2.rb
CHANGED
data/lib/pry/commands.rb
CHANGED
@@ -17,7 +17,7 @@ class Pry
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
command "!", "Clear the input buffer. Useful if the parsing process goes wrong." do
|
20
|
+
command "!", "Clear the input buffer. Useful if the parsing process goes wrong and you get stuck in the read loop." do
|
21
21
|
output.puts "Input buffer cleared!"
|
22
22
|
opts[:eval_string].clear
|
23
23
|
end
|
@@ -33,35 +33,33 @@ class Pry
|
|
33
33
|
alias_command "quit-program", "exit-program", ""
|
34
34
|
|
35
35
|
command "nesting", "Show nesting information." do
|
36
|
-
out = output
|
37
36
|
nesting = opts[:nesting]
|
38
37
|
|
39
|
-
|
40
|
-
|
38
|
+
output.puts "Nesting status:"
|
39
|
+
output.puts "--"
|
41
40
|
nesting.each do |level, obj|
|
42
41
|
if level == 0
|
43
|
-
|
42
|
+
output.puts "#{level}. #{Pry.view_clip(obj)} (Pry top level)"
|
44
43
|
else
|
45
|
-
|
44
|
+
output.puts "#{level}. #{Pry.view_clip(obj)}"
|
46
45
|
end
|
47
46
|
end
|
48
47
|
end
|
49
48
|
|
50
49
|
command "status", "Show status information." do
|
51
|
-
out = output
|
52
50
|
nesting = opts[:nesting]
|
53
51
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
52
|
+
output.puts "Status:"
|
53
|
+
output.puts "--"
|
54
|
+
output.puts "Receiver: #{Pry.view_clip(target.eval('self'))}"
|
55
|
+
output.puts "Nesting level: #{nesting.level}"
|
56
|
+
output.puts "Pry version: #{Pry::VERSION}"
|
57
|
+
output.puts "Ruby version: #{RUBY_VERSION}"
|
60
58
|
|
61
59
|
mn = meth_name_from_binding.call(target)
|
62
|
-
|
63
|
-
|
64
|
-
|
60
|
+
output.puts "Current method: #{mn ? mn : "N/A"}"
|
61
|
+
output.puts "Pry instance: #{Pry.active_instance}"
|
62
|
+
output.puts "Last result: #{Pry.view(Pry.last_result)}"
|
65
63
|
end
|
66
64
|
|
67
65
|
command "version", "Show Pry version." do
|
@@ -74,7 +72,7 @@ class Pry
|
|
74
72
|
|
75
73
|
command "ls", "Show the list of vars in the current scope. Type `ls --help` for more info." do |*args|
|
76
74
|
options = {}
|
77
|
-
|
75
|
+
|
78
76
|
# Set target local to the default -- note that we can set a different target for
|
79
77
|
# ls if we like: e.g ls my_var
|
80
78
|
target = target()
|
@@ -82,51 +80,46 @@ class Pry
|
|
82
80
|
OptionParser.new do |opts|
|
83
81
|
opts.banner = %{Usage: ls [OPTIONS] [VAR]\n\
|
84
82
|
List information about VAR (the current context by default).
|
85
|
-
|
83
|
+
Shows local and instance variables by default.
|
86
84
|
--
|
87
85
|
}
|
88
|
-
|
89
|
-
opts.on("-g", "--globals", "Display global variables.") do |g|
|
86
|
+
opts.on("-g", "--globals", "Display global variables.") do
|
90
87
|
options[:g] = true
|
91
88
|
end
|
92
89
|
|
93
|
-
opts.on("-c", "--constants", "Display constants.") do
|
90
|
+
opts.on("-c", "--constants", "Display constants.") do
|
94
91
|
options[:c] = true
|
95
92
|
end
|
96
93
|
|
97
|
-
opts.on("-l", "--locals", "Display locals.") do
|
94
|
+
opts.on("-l", "--locals", "Display locals.") do
|
98
95
|
options[:l] = true
|
99
96
|
end
|
100
97
|
|
101
|
-
opts.on("-i", "--ivars", "Display instance variables.") do
|
98
|
+
opts.on("-i", "--ivars", "Display instance variables.") do
|
102
99
|
options[:i] = true
|
103
100
|
end
|
104
101
|
|
105
|
-
opts.on("-k", "--class-vars", "Display class variables.") do
|
102
|
+
opts.on("-k", "--class-vars", "Display class variables.") do
|
106
103
|
options[:k] = true
|
107
104
|
end
|
108
105
|
|
109
|
-
opts.on("-m", "--methods", "Display methods.") do
|
106
|
+
opts.on("-m", "--methods", "Display methods.") do
|
110
107
|
options[:m] = true
|
111
108
|
end
|
112
109
|
|
113
|
-
opts.on("-M", "--instance-methods", "Display instance methods (only relevant to classes and modules).") do
|
110
|
+
opts.on("-M", "--instance-methods", "Display instance methods (only relevant to classes and modules).") do
|
114
111
|
options[:M] = true
|
115
112
|
end
|
116
113
|
|
117
|
-
opts.on("-s", "--super", "Include superclass entries (relevant to constant and methods options).") do
|
114
|
+
opts.on("-s", "--super", "Include superclass entries (relevant to constant and methods options).") do
|
118
115
|
options[:s] = true
|
119
116
|
end
|
120
117
|
|
121
|
-
opts.on("-
|
122
|
-
options[:r] = true
|
123
|
-
end
|
124
|
-
|
125
|
-
opts.on("-a", "--all", "Display all types of entries.") do |a|
|
118
|
+
opts.on("-a", "--all", "Display all types of entries.") do
|
126
119
|
options[:a] = true
|
127
120
|
end
|
128
121
|
|
129
|
-
opts.on("-v", "--verbose", "Verbose ouput.") do
|
122
|
+
opts.on("-v", "--verbose", "Verbose ouput.") do
|
130
123
|
options[:v] = true
|
131
124
|
end
|
132
125
|
|
@@ -141,6 +134,14 @@ Always shows local and instance variables by default; use -r to restrict to spec
|
|
141
134
|
# exit if we've displayed help
|
142
135
|
next if options[:h]
|
143
136
|
|
137
|
+
# default is locals/ivars/class vars.
|
138
|
+
# Only occurs when no options or when only option is verbose
|
139
|
+
options.merge!({
|
140
|
+
:l => true,
|
141
|
+
:i => true,
|
142
|
+
:k => true
|
143
|
+
}) if options.empty? || (options.size == 1 && options[:v])
|
144
|
+
|
144
145
|
info = {}
|
145
146
|
target_self = target.eval('self')
|
146
147
|
|
@@ -148,23 +149,29 @@ Always shows local and instance variables by default; use -r to restrict to spec
|
|
148
149
|
# interpolating in the string)
|
149
150
|
options[:s] = !!options[:s]
|
150
151
|
|
151
|
-
# Numbers (e.g 0, 1, 2) are for ordering the hash values in Ruby
|
152
|
-
# 1.8
|
152
|
+
# Numbers (e.g 0, 1, 2) are for ordering the hash values in Ruby 1.8
|
153
153
|
i = -1
|
154
|
-
info["local variables"] = Array(target.eval("local_variables")).sort, i += 1 if !options[:r] || options[:l] || options[:a]
|
155
|
-
info["instance variables"] = Array(target.eval("instance_variables")).sort, i += 1 if !options[:r] || options[:i] || options[:a]
|
156
|
-
info["class variables"] = (target_self.is_a?(Module) ? Array(target.eval("class_variables")).sort : Array(target.eval("self.class.class_variables")).sort), i += 1 if !options[:r] || options[:k] || options[:a]
|
157
154
|
|
158
|
-
|
155
|
+
# Start collecting the entries selected by the user
|
156
|
+
info["local variables"] = [Array(target.eval("local_variables")).sort, i += 1] if options[:l] || options[:a]
|
157
|
+
info["instance variables"] = [Array(target.eval("instance_variables")).sort, i += 1] if options[:i] || options[:a]
|
158
|
+
|
159
|
+
info["class variables"] = [if target_self.is_a?(Module)
|
160
|
+
Array(target.eval("class_variables")).sort
|
161
|
+
else
|
162
|
+
Array(target.eval("self.class.class_variables")).sort
|
163
|
+
end, i += 1] if options[:k] || options[:a]
|
164
|
+
|
165
|
+
info["global variables"] = [Array(target.eval("global_variables")).sort, i += 1] if options[:g] || options[:a]
|
159
166
|
|
160
|
-
info["methods"] = Array(target.eval("methods(#{options[:s]}) + public_methods(#{options[:s]}) +\
|
167
|
+
info["methods"] = [Array(target.eval("methods(#{options[:s]}) + public_methods(#{options[:s]}) +\
|
161
168
|
protected_methods(#{options[:s]}) +\
|
162
|
-
private_methods(#{options[:s]})")).uniq.sort, i += 1 if options[:m] || options[:a]
|
169
|
+
private_methods(#{options[:s]})")).uniq.sort, i += 1] if options[:m] || options[:a]
|
163
170
|
|
164
|
-
info["instance methods"] = Array(target.eval("instance_methods(#{options[:s]}) +\
|
171
|
+
info["instance methods"] = [Array(target.eval("instance_methods(#{options[:s]}) +\
|
165
172
|
public_instance_methods(#{options[:s]}) +\
|
166
173
|
protected_instance_methods(#{options[:s]}) +\
|
167
|
-
private_instance_methods(#{options[:s]})")).uniq.sort, i += 1 if target_self.is_a?(Module) && (options[:M] || options[:a])
|
174
|
+
private_instance_methods(#{options[:s]})")).uniq.sort, i += 1] if target_self.is_a?(Module) && (options[:M] || options[:a])
|
168
175
|
|
169
176
|
# dealing with 1.8/1.9 compatibility issues :/
|
170
177
|
csuper = options[:s]
|
@@ -172,8 +179,8 @@ Always shows local and instance variables by default; use -r to restrict to spec
|
|
172
179
|
csuper = nil
|
173
180
|
end
|
174
181
|
|
175
|
-
info["constants"] = Array(target_self.is_a?(Module) ? target.eval("constants(#{csuper})") :
|
176
|
-
target.eval("self.class.constants(#{csuper})")).uniq.sort, i += 1 if options[:c] || options[:a]
|
182
|
+
info["constants"] = [Array(target_self.is_a?(Module) ? target.eval("constants(#{csuper})") :
|
183
|
+
target.eval("self.class.constants(#{csuper})")).uniq.sort, i += 1] if options[:c] || options[:a]
|
177
184
|
|
178
185
|
# verbose output?
|
179
186
|
if options[:v]
|
@@ -193,13 +200,63 @@ Always shows local and instance variables by default; use -r to restrict to spec
|
|
193
200
|
end
|
194
201
|
end
|
195
202
|
|
203
|
+
command "cat-file", "Show output of file FILE" do |file_name|
|
204
|
+
if !file_name
|
205
|
+
output.puts "Must provide a file name."
|
206
|
+
next
|
207
|
+
end
|
208
|
+
|
209
|
+
output.puts File.read(file_name)
|
210
|
+
end
|
211
|
+
|
212
|
+
command "eval-file", "Eval a Ruby script. Type `eval-file --help` for more info." do |*args|
|
213
|
+
options = {}
|
214
|
+
file_name = nil
|
215
|
+
|
216
|
+
OptionParser.new do |opts|
|
217
|
+
opts.banner = %{Usage: eval-file [OPTIONS] FILE
|
218
|
+
Eval a Ruby script at top-level or in the current context.
|
219
|
+
e.g: eval-script -c "hello.rb"
|
220
|
+
--
|
221
|
+
}
|
222
|
+
opts.on("-c", "--context", "Eval the script in the current context.") do
|
223
|
+
options[:c] = true
|
224
|
+
end
|
225
|
+
|
226
|
+
opts.on_tail("-h", "--help", "This message.") do
|
227
|
+
output.puts opts
|
228
|
+
options[:h] = true
|
229
|
+
end
|
230
|
+
end.order(args) do |v|
|
231
|
+
file_name = v
|
232
|
+
end
|
233
|
+
|
234
|
+
next if options[:h]
|
235
|
+
|
236
|
+
if !file_name
|
237
|
+
output.puts "You need to specify a file name. Type `eval-script --help` for help"
|
238
|
+
next
|
239
|
+
end
|
240
|
+
|
241
|
+
old_constants = Object.constants
|
242
|
+
if options[:c]
|
243
|
+
target.eval(File.read(file_name))
|
244
|
+
output.puts "--\nEval'd '#{file_name}' in the current context."
|
245
|
+
else
|
246
|
+
TOPLEVEL_BINDING.eval(File.read(file_name))
|
247
|
+
output.puts "--\nEval'd '#{file_name}' at top-level."
|
248
|
+
end
|
249
|
+
new_constants = Object.constants - old_constants
|
250
|
+
output.puts "Brought in the following top-level constants: #{new_constants.inspect}" if !new_constants.empty?
|
251
|
+
end
|
252
|
+
|
196
253
|
command "cat", "Show output of VAR.inspect. Aliases: inspect" do |obj|
|
197
254
|
if !obj
|
198
255
|
output.puts "Must provide an object to inspect."
|
199
256
|
next
|
200
257
|
end
|
201
258
|
|
202
|
-
output.puts target.eval("#{obj}
|
259
|
+
output.puts Pry.view(target.eval("#{obj}"))
|
203
260
|
end
|
204
261
|
|
205
262
|
alias_command "inspect", "cat", ""
|
@@ -224,11 +281,11 @@ Show the comments above method METH. Shows _method_ comments (rather than instan
|
|
224
281
|
e.g show-doc hello_method
|
225
282
|
--
|
226
283
|
}
|
227
|
-
opts.on("-M", "--instance-methods", "Operate on instance methods instead.") do
|
284
|
+
opts.on("-M", "--instance-methods", "Operate on instance methods instead.") do
|
228
285
|
options[:M] = true
|
229
286
|
end
|
230
287
|
|
231
|
-
opts.on_tail("-h", "--help", "This message.") do
|
288
|
+
opts.on_tail("-h", "--help", "This message.") do
|
232
289
|
output.puts opts
|
233
290
|
options[:h] = true
|
234
291
|
end
|
@@ -256,7 +313,7 @@ e.g show-doc hello_method
|
|
256
313
|
|
257
314
|
doc = meth.comment
|
258
315
|
file, line = meth.source_location
|
259
|
-
output.puts "From #{file} @ line ~#{line}
|
316
|
+
output.puts "From #{file} @ line ~#{line}:\n--"
|
260
317
|
output.puts doc
|
261
318
|
end
|
262
319
|
|
@@ -270,11 +327,11 @@ Show the source for method METH. Shows _method_ source (rather than instance met
|
|
270
327
|
e.g: show-method hello_method
|
271
328
|
--
|
272
329
|
}
|
273
|
-
opts.on("-M", "--instance-methods", "Operate on instance methods instead.") do
|
330
|
+
opts.on("-M", "--instance-methods", "Operate on instance methods instead.") do
|
274
331
|
options[:M] = true
|
275
332
|
end
|
276
333
|
|
277
|
-
opts.on_tail("-h", "--help", "This message.") do
|
334
|
+
opts.on_tail("-h", "--help", "This message.") do
|
278
335
|
output.puts opts
|
279
336
|
options[:h] = true
|
280
337
|
end
|
@@ -305,7 +362,7 @@ e.g: show-method hello_method
|
|
305
362
|
|
306
363
|
code = meth.source
|
307
364
|
file, line = meth.source_location
|
308
|
-
output.puts "From #{file} @ line #{line}
|
365
|
+
output.puts "From #{file} @ line #{line}:\n--"
|
309
366
|
output.puts code
|
310
367
|
end
|
311
368
|
|
@@ -321,7 +378,7 @@ e.g: show-method hello_method
|
|
321
378
|
meth = cmds[command_name][:action]
|
322
379
|
code = meth.source
|
323
380
|
file, line = meth.source_location
|
324
|
-
output.puts "From #{file} @ line #{line}
|
381
|
+
output.puts "From #{file} @ line #{line}:\n--"
|
325
382
|
output.puts code
|
326
383
|
else
|
327
384
|
output.puts "No such command: #{command_name}."
|
data/lib/pry/version.rb
CHANGED
metadata
CHANGED
@@ -1,56 +1,82 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: -223651599
|
5
5
|
prerelease: 5
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 5
|
9
|
+
- 0
|
10
|
+
- pre
|
11
|
+
- 4
|
12
|
+
version: 0.5.0pre4
|
6
13
|
platform: ruby
|
7
|
-
authors:
|
14
|
+
authors:
|
8
15
|
- John Mair (banisterfiend)
|
9
16
|
autorequire:
|
10
17
|
bindir: bin
|
11
18
|
cert_chain: []
|
12
|
-
|
19
|
+
|
20
|
+
date: 2011-02-17 00:00:00 +13:00
|
13
21
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
22
|
+
dependencies:
|
23
|
+
- !ruby/object:Gem::Dependency
|
16
24
|
name: ruby_parser
|
17
|
-
|
25
|
+
prerelease: false
|
26
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
27
|
none: false
|
19
|
-
requirements:
|
20
|
-
- -
|
21
|
-
- !ruby/object:Gem::Version
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
hash: 5
|
32
|
+
segments:
|
33
|
+
- 2
|
34
|
+
- 0
|
35
|
+
- 5
|
22
36
|
version: 2.0.5
|
23
37
|
type: :runtime
|
24
|
-
|
25
|
-
|
26
|
-
- !ruby/object:Gem::Dependency
|
38
|
+
version_requirements: *id001
|
39
|
+
- !ruby/object:Gem::Dependency
|
27
40
|
name: method_source
|
28
|
-
|
41
|
+
prerelease: false
|
42
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
29
43
|
none: false
|
30
|
-
requirements:
|
31
|
-
- -
|
32
|
-
- !ruby/object:Gem::Version
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
hash: 23
|
48
|
+
segments:
|
49
|
+
- 0
|
50
|
+
- 2
|
51
|
+
- 0
|
33
52
|
version: 0.2.0
|
34
53
|
type: :runtime
|
35
|
-
|
36
|
-
|
37
|
-
- !ruby/object:Gem::Dependency
|
54
|
+
version_requirements: *id002
|
55
|
+
- !ruby/object:Gem::Dependency
|
38
56
|
name: bacon
|
39
|
-
|
57
|
+
prerelease: false
|
58
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
40
59
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
hash: 19
|
64
|
+
segments:
|
65
|
+
- 1
|
66
|
+
- 1
|
67
|
+
- 0
|
44
68
|
version: 1.1.0
|
45
69
|
type: :development
|
46
|
-
|
47
|
-
version_requirements: *17856744
|
70
|
+
version_requirements: *id003
|
48
71
|
description: attach an irb-like session to any object at runtime
|
49
72
|
email: jrmair@gmail.com
|
50
73
|
executables: []
|
74
|
+
|
51
75
|
extensions: []
|
76
|
+
|
52
77
|
extra_rdoc_files: []
|
53
|
-
|
78
|
+
|
79
|
+
files:
|
54
80
|
- lib/pry/commands.rb
|
55
81
|
- lib/pry/command_base.rb
|
56
82
|
- lib/pry/completion.rb
|
@@ -82,26 +108,38 @@ files:
|
|
82
108
|
has_rdoc: true
|
83
109
|
homepage: http://banisterfiend.wordpress.com
|
84
110
|
licenses: []
|
111
|
+
|
85
112
|
post_install_message:
|
86
113
|
rdoc_options: []
|
87
|
-
|
114
|
+
|
115
|
+
require_paths:
|
88
116
|
- lib
|
89
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
118
|
none: false
|
91
|
-
requirements:
|
92
|
-
- -
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
|
95
|
-
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
hash: 3
|
123
|
+
segments:
|
124
|
+
- 0
|
125
|
+
version: "0"
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
127
|
none: false
|
97
|
-
requirements:
|
98
|
-
- -
|
99
|
-
- !ruby/object:Gem::Version
|
128
|
+
requirements:
|
129
|
+
- - ">"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
hash: 25
|
132
|
+
segments:
|
133
|
+
- 1
|
134
|
+
- 3
|
135
|
+
- 1
|
100
136
|
version: 1.3.1
|
101
137
|
requirements: []
|
138
|
+
|
102
139
|
rubyforge_project:
|
103
140
|
rubygems_version: 1.5.2
|
104
141
|
signing_key:
|
105
142
|
specification_version: 3
|
106
143
|
summary: attach an irb-like session to any object at runtime
|
107
144
|
test_files: []
|
145
|
+
|