pry 0.6.8.1-i386-mswin32 → 0.7.0-i386-mswin32
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/CHANGELOG +5 -0
- data/README.markdown +9 -2
- data/Rakefile +3 -3
- data/lib/pry.rb +1 -0
- data/lib/pry/commands.rb +148 -67
- data/lib/pry/pry_class.rb +9 -0
- data/lib/pry/pry_instance.rb +23 -6
- data/lib/pry/version.rb +1 -1
- metadata +8 -17
data/CHANGELOG
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
15/3/2011 version 0.7.0
|
2
|
+
* add pry-doc support with syntax highlighting for docs
|
3
|
+
* add 'mj' option to ls (restrict to singleton methods)
|
4
|
+
* add _ex_ local to hold last exception raised in an exception
|
5
|
+
|
1
6
|
6/3/2011 version 0.6.8
|
2
7
|
* add whereami command, a la the `ir_b` gem
|
3
8
|
* make whereami run at the start of every session
|
data/README.markdown
CHANGED
@@ -22,9 +22,14 @@ is trivial to set it to read from any object that has a `readline` method and wr
|
|
22
22
|
`puts` method - many other aspects of Pry are also configurable making
|
23
23
|
it a good choice for implementing custom shells.
|
24
24
|
|
25
|
-
Pry
|
25
|
+
Pry comes with an executable so it can be invoked at the command line.
|
26
26
|
Just enter `pry` to start. A `.pryrc` file in the user's home directory will
|
27
|
-
be loaded if it exists. Type `pry --help` at the command line for more
|
27
|
+
be loaded if it exists. Type `pry --help` at the command line for more
|
28
|
+
information.
|
29
|
+
|
30
|
+
Try `gem install pry-doc` for additional documentation on Ruby Core
|
31
|
+
methods. The additional docs are accessed through the `show-doc` and
|
32
|
+
`show-method` commands.
|
28
33
|
|
29
34
|
* Install the [gem](https://rubygems.org/gems/pry): `gem install pry`
|
30
35
|
* Read the [documentation](http://rdoc.info/github/banister/pry/master/file/README.markdown)
|
@@ -163,10 +168,12 @@ end.
|
|
163
168
|
###Features:
|
164
169
|
|
165
170
|
* Pry can be invoked at any time and on any object in the running program.
|
171
|
+
* Additional documentation and source code for Ruby Core methods are supported when the `pry-doc` gem is installed.
|
166
172
|
* Pry sessions can nest arbitrarily deeply -- to go back one level of nesting type 'exit' or 'quit' or 'back'
|
167
173
|
* Pry comes with syntax highlighting on by default just use the `toggle-color` command to turn it on and off.
|
168
174
|
* Use `_` to recover last result.
|
169
175
|
* Use `_pry_` to reference the Pry instance managing the current session.
|
176
|
+
* Use `_ex_` to recover the last exception.
|
170
177
|
* Pry supports tab completion.
|
171
178
|
* Pry has multi-line support built in.
|
172
179
|
* Use `^d` (control-d) to quickly break out of a session.
|
data/Rakefile
CHANGED
@@ -8,7 +8,7 @@ require "#{direc}/lib/pry/version"
|
|
8
8
|
CLOBBER.include("**/*.#{dlext}", "**/*~", "**/*#*", "**/*.log", "**/*.o")
|
9
9
|
CLEAN.include("ext/**/*.#{dlext}", "ext/**/*.log", "ext/**/*.o",
|
10
10
|
"ext/**/*~", "ext/**/*#*", "ext/**/*.obj", "**/*#*", "**/*#*.*",
|
11
|
-
"ext/**/*.def", "ext/**/*.pdb", "**/*_flymake*.*", "**/*_flymake")
|
11
|
+
"ext/**/*.def", "ext/**/*.pdb", "**/*_flymake*.*", "**/*_flymake", "**/*.rbc")
|
12
12
|
|
13
13
|
def apply_spec_defaults(s)
|
14
14
|
s.name = "pry"
|
@@ -25,8 +25,8 @@ def apply_spec_defaults(s)
|
|
25
25
|
s.homepage = "http://banisterfiend.wordpress.com"
|
26
26
|
s.has_rdoc = 'yard'
|
27
27
|
s.executables = ["pry"]
|
28
|
-
s.files = Dir["ext/**/extconf.rb", "ext/**/*.h", "ext/**/*.c", "lib
|
29
|
-
|
28
|
+
s.files = Dir["ext/**/extconf.rb", "ext/**/*.h", "ext/**/*.c", "lib/**/*", "examples/**/*.rb",
|
29
|
+
"test/*.rb", "test/testrc", "CHANGELOG", "LICENSE", "README.markdown", "Rakefile", ".gemtest"]
|
30
30
|
end
|
31
31
|
|
32
32
|
task :test do
|
data/lib/pry.rb
CHANGED
data/lib/pry/commands.rb
CHANGED
@@ -3,6 +3,11 @@ require "method_source"
|
|
3
3
|
require "pry/command_base"
|
4
4
|
require "pry/pry_instance"
|
5
5
|
|
6
|
+
begin
|
7
|
+
require "pry-doc"
|
8
|
+
rescue LoadError
|
9
|
+
end
|
10
|
+
|
6
11
|
class Pry
|
7
12
|
|
8
13
|
# Default commands used by Pry.
|
@@ -30,44 +35,29 @@ class Pry
|
|
30
35
|
text.split.drop(1).join(' ')
|
31
36
|
end
|
32
37
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
check_for_dynamically_defined_method.call(file)
|
45
|
-
|
46
|
-
output.puts "--\nFrom #{file} @ line #{line_num} in #{klass}##{meth_name}:\n--"
|
47
|
-
|
48
|
-
# This method inspired by http://rubygems.org/gems/ir_b
|
49
|
-
File.open(file).each_with_index do |line, index|
|
50
|
-
line_n = index + 1
|
51
|
-
next unless line_n > (line_num - 6)
|
52
|
-
break if line_n > (line_num + 5)
|
53
|
-
if line_n == line_num
|
54
|
-
code =" =>#{line_n.to_s.rjust(3)}: #{line.chomp}"
|
55
|
-
if Pry.color
|
56
|
-
code = CodeRay.scan(code, :ruby).term
|
57
|
-
end
|
58
|
-
output.puts code
|
59
|
-
code
|
60
|
-
else
|
61
|
-
code = "#{line_n.to_s.rjust(6)}: #{line.chomp}"
|
62
|
-
if Pry.color
|
63
|
-
code = CodeRay.scan(code, :ruby).term
|
64
|
-
end
|
65
|
-
output.puts code
|
66
|
-
code
|
38
|
+
get_method_object = lambda do |meth_name, target, options|
|
39
|
+
if options[:M]
|
40
|
+
target.eval("instance_method(:#{meth_name})")
|
41
|
+
elsif options[:m]
|
42
|
+
target.eval("method(:#{meth_name})")
|
43
|
+
else
|
44
|
+
begin
|
45
|
+
target.eval("instance_method(:#{meth_name})")
|
46
|
+
rescue
|
47
|
+
target.eval("method(:#{meth_name})")
|
67
48
|
end
|
68
49
|
end
|
69
50
|
end
|
70
|
-
|
51
|
+
|
52
|
+
make_header = lambda do |file, line, code_type|
|
53
|
+
header = case code_type
|
54
|
+
when :ruby
|
55
|
+
"--\nFrom #{file} @ line #{line}:\n--"
|
56
|
+
else
|
57
|
+
"--\nFrom Ruby Core (C Method):\n--"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
71
61
|
command "!", "Clear the input buffer. Useful if the parsing process goes wrong and you get stuck in the read loop." do
|
72
62
|
output.puts "Input buffer cleared!"
|
73
63
|
opts[:eval_string].clear
|
@@ -128,6 +118,44 @@ class Pry
|
|
128
118
|
output.puts "Last result: #{Pry.view(Pry.last_result)}"
|
129
119
|
end
|
130
120
|
|
121
|
+
command "whereami", "Show the code context for the session." do
|
122
|
+
file = target.eval('__FILE__')
|
123
|
+
line_num = target.eval('__LINE__')
|
124
|
+
klass = target.eval('self.class')
|
125
|
+
|
126
|
+
meth_name = meth_name_from_binding.call(target)
|
127
|
+
if !meth_name
|
128
|
+
output.puts "Cannot find containing method. Did you remember to use \`binding.pry\` ?"
|
129
|
+
next
|
130
|
+
end
|
131
|
+
|
132
|
+
check_for_dynamically_defined_method.call(file)
|
133
|
+
|
134
|
+
output.puts "--\nFrom #{file} @ line #{line_num} in #{klass}##{meth_name}:\n--"
|
135
|
+
|
136
|
+
# This method inspired by http://rubygems.org/gems/ir_b
|
137
|
+
File.open(file).each_with_index do |line, index|
|
138
|
+
line_n = index + 1
|
139
|
+
next unless line_n > (line_num - 6)
|
140
|
+
break if line_n > (line_num + 5)
|
141
|
+
if line_n == line_num
|
142
|
+
code =" =>#{line_n.to_s.rjust(3)}: #{line.chomp}"
|
143
|
+
if Pry.color
|
144
|
+
code = CodeRay.scan(code, :ruby).term
|
145
|
+
end
|
146
|
+
output.puts code
|
147
|
+
code
|
148
|
+
else
|
149
|
+
code = "#{line_n.to_s.rjust(6)}: #{line.chomp}"
|
150
|
+
if Pry.color
|
151
|
+
code = CodeRay.scan(code, :ruby).term
|
152
|
+
end
|
153
|
+
output.puts code
|
154
|
+
code
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
131
159
|
command "version", "Show Pry version." do
|
132
160
|
output.puts "Pry version: #{Pry::VERSION} on Ruby #{RUBY_VERSION}."
|
133
161
|
end
|
@@ -190,6 +218,10 @@ Shows local and instance variables by default.
|
|
190
218
|
|
191
219
|
opts.on("-p", "--private", "Display private methods (with -m).") do
|
192
220
|
options[:p] = true
|
221
|
+
end
|
222
|
+
|
223
|
+
opts.on("-j", "--just-singletons", "Display just the singleton methods (with -m).") do
|
224
|
+
options[:j] = true
|
193
225
|
end
|
194
226
|
|
195
227
|
opts.on("-s", "--super", "Include superclass entries (relevant to constant and methods options).") do
|
@@ -224,7 +256,7 @@ Shows local and instance variables by default.
|
|
224
256
|
}) if options.empty? || (options.size == 1 && options[:v])
|
225
257
|
|
226
258
|
# Display public methods by default if -m or -M switch is used.
|
227
|
-
options[:P] = true if (options[:m] || options[:M]) && !(options[:p] || options[:r])
|
259
|
+
options[:P] = true if (options[:m] || options[:M]) && !(options[:p] || options[:r] || options[:j])
|
228
260
|
|
229
261
|
info = {}
|
230
262
|
target_self = target.eval('self')
|
@@ -253,6 +285,8 @@ Shows local and instance variables by default.
|
|
253
285
|
info["protected methods"] = [Array(target.eval("protected_methods(#{options[:s]})")).sort, i += 1] if (options[:m] && options[:r]) || options[:a]
|
254
286
|
|
255
287
|
info["private methods"] = [Array(target.eval("private_methods(#{options[:s]})")).sort, i += 1] if (options[:m] && options[:p]) || options[:a]
|
288
|
+
|
289
|
+
info["just singleton methods"] = [Array(target.eval("methods(#{options[:s]})")).sort, i += 1] if (options[:m] && options[:j]) || options[:a]
|
256
290
|
|
257
291
|
info["public instance methods"] = [Array(target.eval("public_instance_methods(#{options[:s]})")).uniq.sort, i += 1] if target_self.is_a?(Module) && ((options[:M] && options[:P]) || options[:a])
|
258
292
|
|
@@ -288,6 +322,7 @@ Shows local and instance variables by default.
|
|
288
322
|
# plain
|
289
323
|
else
|
290
324
|
list = info.values.sort_by { |v| v.last }.map { |v| v.first }.inject(&:+)
|
325
|
+
list.uniq! if list
|
291
326
|
if Pry.color
|
292
327
|
output.puts CodeRay.scan(Pry.view(list), :ruby).term
|
293
328
|
else
|
@@ -374,11 +409,23 @@ e.g: eval-file -c self "hello.rb"
|
|
374
409
|
if obj == "/"
|
375
410
|
throw(:breakout, 1) if opts[:nesting].level > 0
|
376
411
|
next
|
377
|
-
end
|
412
|
+
end
|
378
413
|
|
379
414
|
target.eval("#{obj}.pry")
|
380
415
|
end
|
381
416
|
|
417
|
+
process_comment_markup = lambda do |comment, code_type|
|
418
|
+
comment.gsub(/<code>(?:\s*\n)?(.*?)\s*<\/code>/m) { Pry.color ? CodeRay.scan($1, code_type).term : $1 }.
|
419
|
+
gsub(/<em>(?:\s*\n)?(.*?)\s*<\/em>/m) { Pry.color ? "\e[32m#{$1}\e[0m": $1 }.
|
420
|
+
gsub(/<i>(?:\s*\n)?(.*?)\s*<\/i>/m) { Pry.color ? "\e[34m#{$1}\e[0m" : $1 }.
|
421
|
+
gsub(/\B\+(\w*?)\+\B/) { Pry.color ? "\e[32m#{$1}\e[0m": $1 }.
|
422
|
+
gsub(/((?:^[ \t]+.+(?:\n+|\Z))+)/) { Pry.color ? CodeRay.scan($1, code_type).term : $1 }
|
423
|
+
end
|
424
|
+
|
425
|
+
strip_leading_hash_from_ruby_comments = lambda do |comment|
|
426
|
+
comment.gsub /^\s*#\s*/, ''
|
427
|
+
end
|
428
|
+
|
382
429
|
command "show-doc", "Show the comments above METH. Type `show-doc --help` for more info." do |*args|
|
383
430
|
options = {}
|
384
431
|
target = target()
|
@@ -386,14 +433,18 @@ e.g: eval-file -c self "hello.rb"
|
|
386
433
|
|
387
434
|
OptionParser.new do |opts|
|
388
435
|
opts.banner = %{Usage: show-doc [OPTIONS] [METH]
|
389
|
-
Show the comments above method METH.
|
436
|
+
Show the comments above method METH. Tries instance methods first and then methods by default.
|
390
437
|
e.g show-doc hello_method
|
391
438
|
--
|
392
439
|
}
|
393
|
-
opts.on("-M", "--instance-methods", "Operate on instance methods
|
440
|
+
opts.on("-M", "--instance-methods", "Operate on instance methods.") do
|
394
441
|
options[:M] = true
|
395
442
|
end
|
396
443
|
|
444
|
+
opts.on("-m", "--methods", "Operate on methods.") do
|
445
|
+
options[:m] = true
|
446
|
+
end
|
447
|
+
|
397
448
|
opts.on("-c", "--context CONTEXT", "Select object context to run under.") do |context|
|
398
449
|
target = Pry.binding_for(target.eval(context))
|
399
450
|
end
|
@@ -414,30 +465,46 @@ e.g show-doc hello_method
|
|
414
465
|
end
|
415
466
|
|
416
467
|
begin
|
417
|
-
|
418
|
-
meth = target.eval("instance_method(:#{meth_name})")
|
419
|
-
else
|
420
|
-
meth = target.eval("method(:#{meth_name})")
|
421
|
-
end
|
468
|
+
meth = get_method_object.call(meth_name, target, options)
|
422
469
|
rescue
|
423
470
|
output.puts "Invalid method name: #{meth_name}. Type `show-doc --help` for help"
|
424
471
|
next
|
425
472
|
end
|
426
473
|
|
427
|
-
|
474
|
+
code_type = :ruby
|
475
|
+
if Pry.has_pry_doc && meth.source_location.nil?
|
476
|
+
info = Pry::MethodInfo.info_for(meth)
|
477
|
+
if !info
|
478
|
+
output.puts "Cannot find docs for C method: #{meth_name}"
|
479
|
+
next
|
480
|
+
end
|
481
|
+
doc = info.docstring
|
482
|
+
code_type = info.source_type
|
483
|
+
else
|
484
|
+
begin
|
485
|
+
doc = meth.comment
|
486
|
+
rescue
|
487
|
+
output.puts "Cannot locate source for this method: #{meth_name}. Try `gem install pry-doc` to get access to Ruby Core documentation."
|
488
|
+
next
|
489
|
+
end
|
490
|
+
doc = strip_leading_hash_from_ruby_comments.call(doc)
|
491
|
+
end
|
492
|
+
|
493
|
+
doc = process_comment_markup.call(doc, code_type)
|
494
|
+
|
428
495
|
file, line = meth.source_location
|
429
496
|
check_for_dynamically_defined_method.call(file)
|
430
497
|
|
431
|
-
output.puts
|
432
|
-
|
433
|
-
if Pry.color
|
434
|
-
doc = CodeRay.scan(doc, :ruby).term
|
435
|
-
end
|
436
|
-
|
498
|
+
output.puts make_header.call(file, line, code_type)
|
499
|
+
|
437
500
|
output.puts doc
|
438
501
|
doc
|
439
502
|
end
|
440
503
|
|
504
|
+
strip_comments_from_c_code = lambda do |code|
|
505
|
+
code.sub /\A\s*\/\*.*?\*\/\s*/m, ''
|
506
|
+
end
|
507
|
+
|
441
508
|
command "show-method", "Show the source for METH. Type `show-method --help` for more info." do |*args|
|
442
509
|
options = {}
|
443
510
|
target = target()
|
@@ -445,14 +512,18 @@ e.g show-doc hello_method
|
|
445
512
|
|
446
513
|
OptionParser.new do |opts|
|
447
514
|
opts.banner = %{Usage: show-method [OPTIONS] [METH]
|
448
|
-
Show the source for method METH.
|
515
|
+
Show the source for method METH. Tries instance methods first and then methods by default.
|
449
516
|
e.g: show-method hello_method
|
450
517
|
--
|
451
518
|
}
|
452
|
-
opts.on("-M", "--instance-methods", "Operate on instance methods
|
519
|
+
opts.on("-M", "--instance-methods", "Operate on instance methods.") do
|
453
520
|
options[:M] = true
|
454
521
|
end
|
455
522
|
|
523
|
+
opts.on("-m", "--methods", "Operate on methods.") do
|
524
|
+
options[:m] = true
|
525
|
+
end
|
526
|
+
|
456
527
|
opts.on("-c", "--context CONTEXT", "Select object context to run under.") do |context|
|
457
528
|
target = Pry.binding_for(target.eval(context))
|
458
529
|
end
|
@@ -469,36 +540,46 @@ e.g: show-method hello_method
|
|
469
540
|
|
470
541
|
# If no method name is given then use current method, if it exists
|
471
542
|
meth_name = meth_name_from_binding.call(target) if !meth_name
|
472
|
-
|
473
543
|
if !meth_name
|
474
544
|
output.puts "You need to specify a method. Type `show-method --help` for help"
|
475
545
|
next
|
476
546
|
end
|
477
547
|
|
478
548
|
begin
|
479
|
-
|
480
|
-
meth = target.eval("instance_method(:#{meth_name})")
|
481
|
-
else
|
482
|
-
meth = target.eval("method(:#{meth_name})")
|
483
|
-
end
|
549
|
+
meth = get_method_object.call(meth_name, target, options)
|
484
550
|
rescue
|
485
|
-
target_self = target.eval('self')
|
486
|
-
if !options[:M]&& target_self.is_a?(Module) &&
|
487
|
-
target_self.method_defined?(meth_name)
|
488
|
-
output.puts "Did you mean: show-method -M #{meth_name} ?"
|
489
|
-
end
|
490
551
|
output.puts "Invalid method name: #{meth_name}. Type `show-method --help` for help"
|
491
552
|
next
|
492
553
|
end
|
493
554
|
|
494
|
-
|
555
|
+
code_type = :ruby
|
556
|
+
|
557
|
+
# Try to find source for C methods using MethodInfo (if possible)
|
558
|
+
if Pry.has_pry_doc && meth.source_location.nil?
|
559
|
+
info = Pry::MethodInfo.info_for(meth)
|
560
|
+
if !info
|
561
|
+
output.puts "Cannot find source for C method: #{meth_name}"
|
562
|
+
next
|
563
|
+
end
|
564
|
+
code = info.source
|
565
|
+
code = strip_comments_from_c_code.call(code)
|
566
|
+
code_type = info.source_type
|
567
|
+
else
|
568
|
+
begin
|
569
|
+
code = meth.source
|
570
|
+
rescue
|
571
|
+
output.puts "Cannot locate source for this method: #{meth_name}. Try `gem install pry-doc` to get access to Ruby Core documentation."
|
572
|
+
next
|
573
|
+
end
|
574
|
+
end
|
575
|
+
|
495
576
|
file, line = meth.source_location
|
496
577
|
check_for_dynamically_defined_method.call(file)
|
497
578
|
|
498
|
-
output.puts
|
579
|
+
output.puts make_header.call(file, line, code_type)
|
499
580
|
|
500
581
|
if Pry.color
|
501
|
-
code = CodeRay.scan(code,
|
582
|
+
code = CodeRay.scan(code, code_type).term
|
502
583
|
end
|
503
584
|
|
504
585
|
output.puts code
|
data/lib/pry/pry_class.rb
CHANGED
@@ -17,6 +17,11 @@ class Pry
|
|
17
17
|
# @return [Object] The last result.
|
18
18
|
attr_accessor :last_result
|
19
19
|
|
20
|
+
# Get last exception raised.
|
21
|
+
# This method should not need to be accessed directly.
|
22
|
+
# @return [Exception] The last exception.
|
23
|
+
attr_accessor :last_exception
|
24
|
+
|
20
25
|
# Get the active Pry instance that manages the active Pry session.
|
21
26
|
# This method should not need to be accessed directly.
|
22
27
|
# @return [Pry] The active Pry instance.
|
@@ -73,6 +78,10 @@ class Pry
|
|
73
78
|
# Set to true if Pry is invoked from command line using `pry` executable
|
74
79
|
# @return [Boolean]
|
75
80
|
attr_accessor :cli
|
81
|
+
|
82
|
+
# Set to true if the pry-doc extension is loaded.
|
83
|
+
# @return [Boolean]
|
84
|
+
attr_accessor :has_pry_doc
|
76
85
|
end
|
77
86
|
|
78
87
|
# Load the rc files given in the `Pry::RC_FILES` array.
|
data/lib/pry/pry_instance.rb
CHANGED
@@ -135,19 +135,20 @@ class Pry
|
|
135
135
|
Readline.completion_proc = Pry::InputCompleter.build_completion_proc(target, commands.commands.keys)
|
136
136
|
end
|
137
137
|
|
138
|
-
# eval the expression and save to last_result
|
139
|
-
Pry.last_result = target.eval r(target), __FILE__, __LINE__
|
140
138
|
|
141
139
|
# save the pry instance to active_instance
|
142
140
|
Pry.active_instance = self
|
143
|
-
|
144
|
-
# define locals _pry_ and _ (active instance and last expression)
|
145
141
|
target.eval("_pry_ = Pry.active_instance")
|
146
|
-
|
142
|
+
|
143
|
+
# eval the expression and save to last_result
|
144
|
+
# Do not want __FILE__, __LINE__ here because we need to distinguish
|
145
|
+
# (eval) methods for show-method and friends.
|
146
|
+
# This also sets the `_` local for the session.
|
147
|
+
set_last_result(target.eval(r(target)), target)
|
147
148
|
rescue SystemExit => e
|
148
149
|
exit
|
149
150
|
rescue Exception => e
|
150
|
-
e
|
151
|
+
set_last_exception(e, target)
|
151
152
|
end
|
152
153
|
|
153
154
|
# Perform a read.
|
@@ -188,6 +189,22 @@ class Pry
|
|
188
189
|
end
|
189
190
|
end
|
190
191
|
|
192
|
+
# Set the last result of an eval.
|
193
|
+
# @param [Object] result The result.
|
194
|
+
# @param [Binding] target The binding to set `_` on.
|
195
|
+
def set_last_result(result, target)
|
196
|
+
Pry.last_result = result
|
197
|
+
target.eval("_ = Pry.last_result")
|
198
|
+
end
|
199
|
+
|
200
|
+
# Set the last exception for a session.
|
201
|
+
# @param [Exception] ex The exception.
|
202
|
+
# @param [Binding] target The binding to set `_ex_` on.
|
203
|
+
def set_last_exception(ex, target)
|
204
|
+
Pry.last_exception = ex
|
205
|
+
target.eval("_ex_ = Pry.last_exception")
|
206
|
+
end
|
207
|
+
|
191
208
|
# Process Pry commands. Pry commands are not Ruby methods and are evaluated
|
192
209
|
# prior to Ruby expressions.
|
193
210
|
# Commands can be modified/configured by the user: see `Pry::Commands`
|
data/lib/pry/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
4
|
+
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
|
11
|
-
version: 0.6.8.1
|
7
|
+
- 7
|
8
|
+
- 0
|
9
|
+
version: 0.7.0
|
12
10
|
platform: i386-mswin32
|
13
11
|
authors:
|
14
12
|
- John Mair (banisterfiend)
|
@@ -16,7 +14,7 @@ autorequire:
|
|
16
14
|
bindir: bin
|
17
15
|
cert_chain: []
|
18
16
|
|
19
|
-
date: 2011-03-
|
17
|
+
date: 2011-03-15 00:00:00 +13:00
|
20
18
|
default_executable:
|
21
19
|
dependencies:
|
22
20
|
- !ruby/object:Gem::Dependency
|
@@ -27,7 +25,6 @@ dependencies:
|
|
27
25
|
requirements:
|
28
26
|
- - ">="
|
29
27
|
- !ruby/object:Gem::Version
|
30
|
-
hash: 5
|
31
28
|
segments:
|
32
29
|
- 2
|
33
30
|
- 0
|
@@ -43,7 +40,6 @@ dependencies:
|
|
43
40
|
requirements:
|
44
41
|
- - ">="
|
45
42
|
- !ruby/object:Gem::Version
|
46
|
-
hash: 53
|
47
43
|
segments:
|
48
44
|
- 0
|
49
45
|
- 9
|
@@ -59,7 +55,6 @@ dependencies:
|
|
59
55
|
requirements:
|
60
56
|
- - ">="
|
61
57
|
- !ruby/object:Gem::Version
|
62
|
-
hash: 19
|
63
58
|
segments:
|
64
59
|
- 1
|
65
60
|
- 1
|
@@ -75,7 +70,6 @@ dependencies:
|
|
75
70
|
requirements:
|
76
71
|
- - ">="
|
77
72
|
- !ruby/object:Gem::Version
|
78
|
-
hash: 27
|
79
73
|
segments:
|
80
74
|
- 0
|
81
75
|
- 3
|
@@ -91,7 +85,6 @@ dependencies:
|
|
91
85
|
requirements:
|
92
86
|
- - ">="
|
93
87
|
- !ruby/object:Gem::Version
|
94
|
-
hash: 27
|
95
88
|
segments:
|
96
89
|
- 1
|
97
90
|
- 3
|
@@ -108,7 +101,6 @@ extensions: []
|
|
108
101
|
extra_rdoc_files: []
|
109
102
|
|
110
103
|
files:
|
111
|
-
- lib/pry.rb
|
112
104
|
- lib/pry/commands.rb
|
113
105
|
- lib/pry/version.rb
|
114
106
|
- lib/pry/command_base.rb
|
@@ -119,6 +111,7 @@ files:
|
|
119
111
|
- lib/pry/print.rb
|
120
112
|
- lib/pry/pry_class.rb
|
121
113
|
- lib/pry/pry_instance.rb
|
114
|
+
- lib/pry.rb
|
122
115
|
- examples/example_commands.rb
|
123
116
|
- examples/example_image_edit.rb
|
124
117
|
- examples/example_input2.rb
|
@@ -138,7 +131,7 @@ files:
|
|
138
131
|
- Rakefile
|
139
132
|
- .gemtest
|
140
133
|
- bin/pry
|
141
|
-
has_rdoc:
|
134
|
+
has_rdoc: yard
|
142
135
|
homepage: http://banisterfiend.wordpress.com
|
143
136
|
licenses: []
|
144
137
|
|
@@ -152,7 +145,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
152
145
|
requirements:
|
153
146
|
- - ">="
|
154
147
|
- !ruby/object:Gem::Version
|
155
|
-
hash: 3
|
156
148
|
segments:
|
157
149
|
- 0
|
158
150
|
version: "0"
|
@@ -161,14 +153,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
153
|
requirements:
|
162
154
|
- - ">="
|
163
155
|
- !ruby/object:Gem::Version
|
164
|
-
hash: 3
|
165
156
|
segments:
|
166
157
|
- 0
|
167
158
|
version: "0"
|
168
159
|
requirements: []
|
169
160
|
|
170
161
|
rubyforge_project:
|
171
|
-
rubygems_version: 1.
|
162
|
+
rubygems_version: 1.3.7
|
172
163
|
signing_key:
|
173
164
|
specification_version: 3
|
174
165
|
summary: attach an irb-like session to any object at runtime
|