pry 0.7.0pre6 → 0.7.0
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/lib/pry/commands.rb +23 -13
- data/lib/pry/version.rb +1 -1
- metadata +6 -8
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/lib/pry/commands.rb
CHANGED
|
@@ -38,15 +38,15 @@ class Pry
|
|
|
38
38
|
get_method_object = lambda do |meth_name, target, options|
|
|
39
39
|
if options[:M]
|
|
40
40
|
target.eval("instance_method(:#{meth_name})")
|
|
41
|
-
|
|
41
|
+
elsif options[:m]
|
|
42
42
|
target.eval("method(:#{meth_name})")
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
end
|
|
43
|
+
else
|
|
44
|
+
begin
|
|
45
|
+
target.eval("instance_method(:#{meth_name})")
|
|
46
|
+
rescue
|
|
47
|
+
target.eval("method(:#{meth_name})")
|
|
49
48
|
end
|
|
49
|
+
end
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
make_header = lambda do |file, line, code_type|
|
|
@@ -418,7 +418,7 @@ e.g: eval-file -c self "hello.rb"
|
|
|
418
418
|
comment.gsub(/<code>(?:\s*\n)?(.*?)\s*<\/code>/m) { Pry.color ? CodeRay.scan($1, code_type).term : $1 }.
|
|
419
419
|
gsub(/<em>(?:\s*\n)?(.*?)\s*<\/em>/m) { Pry.color ? "\e[32m#{$1}\e[0m": $1 }.
|
|
420
420
|
gsub(/<i>(?:\s*\n)?(.*?)\s*<\/i>/m) { Pry.color ? "\e[34m#{$1}\e[0m" : $1 }.
|
|
421
|
-
gsub(/\B\+(
|
|
421
|
+
gsub(/\B\+(\w*?)\+\B/) { Pry.color ? "\e[32m#{$1}\e[0m": $1 }.
|
|
422
422
|
gsub(/((?:^[ \t]+.+(?:\n+|\Z))+)/) { Pry.color ? CodeRay.scan($1, code_type).term : $1 }
|
|
423
423
|
end
|
|
424
424
|
|
|
@@ -433,7 +433,7 @@ e.g: eval-file -c self "hello.rb"
|
|
|
433
433
|
|
|
434
434
|
OptionParser.new do |opts|
|
|
435
435
|
opts.banner = %{Usage: show-doc [OPTIONS] [METH]
|
|
436
|
-
Show the comments above method METH.
|
|
436
|
+
Show the comments above method METH. Tries instance methods first and then methods by default.
|
|
437
437
|
e.g show-doc hello_method
|
|
438
438
|
--
|
|
439
439
|
}
|
|
@@ -472,7 +472,6 @@ e.g show-doc hello_method
|
|
|
472
472
|
end
|
|
473
473
|
|
|
474
474
|
code_type = :ruby
|
|
475
|
-
|
|
476
475
|
if Pry.has_pry_doc && meth.source_location.nil?
|
|
477
476
|
info = Pry::MethodInfo.info_for(meth)
|
|
478
477
|
if !info
|
|
@@ -482,7 +481,13 @@ e.g show-doc hello_method
|
|
|
482
481
|
doc = info.docstring
|
|
483
482
|
code_type = info.source_type
|
|
484
483
|
else
|
|
485
|
-
|
|
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)
|
|
486
491
|
end
|
|
487
492
|
|
|
488
493
|
doc = process_comment_markup.call(doc, code_type)
|
|
@@ -507,7 +512,7 @@ e.g show-doc hello_method
|
|
|
507
512
|
|
|
508
513
|
OptionParser.new do |opts|
|
|
509
514
|
opts.banner = %{Usage: show-method [OPTIONS] [METH]
|
|
510
|
-
Show the source for method METH.
|
|
515
|
+
Show the source for method METH. Tries instance methods first and then methods by default.
|
|
511
516
|
e.g: show-method hello_method
|
|
512
517
|
--
|
|
513
518
|
}
|
|
@@ -560,7 +565,12 @@ e.g: show-method hello_method
|
|
|
560
565
|
code = strip_comments_from_c_code.call(code)
|
|
561
566
|
code_type = info.source_type
|
|
562
567
|
else
|
|
563
|
-
|
|
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
|
|
564
574
|
end
|
|
565
575
|
|
|
566
576
|
file, line = meth.source_location
|
data/lib/pry/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pry
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
prerelease:
|
|
4
|
+
prerelease: false
|
|
5
5
|
segments:
|
|
6
6
|
- 0
|
|
7
7
|
- 7
|
|
8
|
-
-
|
|
9
|
-
version: 0.7.
|
|
8
|
+
- 0
|
|
9
|
+
version: 0.7.0
|
|
10
10
|
platform: ruby
|
|
11
11
|
authors:
|
|
12
12
|
- John Mair (banisterfiend)
|
|
@@ -136,13 +136,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
136
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
137
|
none: false
|
|
138
138
|
requirements:
|
|
139
|
-
- - "
|
|
139
|
+
- - ">="
|
|
140
140
|
- !ruby/object:Gem::Version
|
|
141
141
|
segments:
|
|
142
|
-
-
|
|
143
|
-
|
|
144
|
-
- 1
|
|
145
|
-
version: 1.3.1
|
|
142
|
+
- 0
|
|
143
|
+
version: "0"
|
|
146
144
|
requirements: []
|
|
147
145
|
|
|
148
146
|
rubyforge_project:
|