pry 0.9.6.1-i386-mswin32 → 0.9.6.2-i386-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/Rakefile +6 -6
- data/lib/pry.rb +0 -3
- data/lib/pry/command_context.rb +0 -1
- data/lib/pry/command_set.rb +0 -2
- data/lib/pry/default_commands/basic.rb +7 -5
- data/lib/pry/default_commands/context.rb +3 -5
- data/lib/pry/default_commands/documentation.rb +79 -28
- data/lib/pry/default_commands/input.rb +7 -3
- data/lib/pry/default_commands/introspection.rb +52 -33
- data/lib/pry/default_commands/shell.rb +2 -2
- data/lib/pry/extended_commands/experimental.rb +6 -2
- data/lib/pry/helpers/base_helpers.rb +1 -1
- data/lib/pry/helpers/command_helpers.rb +247 -11
- data/lib/pry/version.rb +1 -1
- data/pry.gemspec +15 -15
- data/test/test_command_helpers.rb +69 -1
- data/test/test_command_set.rb +28 -29
- data/test/test_default_commands/test_introspection.rb +25 -0
- metadata +22 -27
- data/lib/pry/method.rb +0 -184
- data/lib/pry/rbx_method.rb +0 -20
- data/lib/pry/rbx_path.rb +0 -34
- data/test/test_method.rb +0 -72
data/test/test_command_set.rb
CHANGED
@@ -3,7 +3,6 @@ require 'helper'
|
|
3
3
|
describe Pry::CommandSet do
|
4
4
|
before do
|
5
5
|
@set = Pry::CommandSet.new
|
6
|
-
@ctx = Pry::CommandContext.new
|
7
6
|
end
|
8
7
|
|
9
8
|
it 'should call the block used for the command when it is called' do
|
@@ -12,7 +11,7 @@ describe Pry::CommandSet do
|
|
12
11
|
run = true
|
13
12
|
end
|
14
13
|
|
15
|
-
@set.run_command
|
14
|
+
@set.run_command nil, 'foo'
|
16
15
|
run.should == true
|
17
16
|
end
|
18
17
|
|
@@ -21,23 +20,21 @@ describe Pry::CommandSet do
|
|
21
20
|
args.should == [1, 2, 3]
|
22
21
|
end
|
23
22
|
|
24
|
-
@set.run_command
|
23
|
+
@set.run_command nil, 'foo', 1, 2, 3
|
25
24
|
end
|
26
25
|
|
27
26
|
it 'should use the first argument as self' do
|
28
|
-
ctx = @ctx
|
29
|
-
|
30
27
|
@set.command 'foo' do
|
31
|
-
self.should ==
|
28
|
+
self.should == true
|
32
29
|
end
|
33
30
|
|
34
|
-
@set.run_command
|
31
|
+
@set.run_command true, 'foo'
|
35
32
|
end
|
36
33
|
|
37
34
|
it 'should raise an error when calling an undefined command' do
|
38
35
|
@set.command('foo') {}
|
39
36
|
lambda {
|
40
|
-
@set.run_command
|
37
|
+
@set.run_command nil, 'bar'
|
41
38
|
}.should.raise(Pry::NoCommandError)
|
42
39
|
end
|
43
40
|
|
@@ -46,7 +43,7 @@ describe Pry::CommandSet do
|
|
46
43
|
@set.delete 'foo'
|
47
44
|
|
48
45
|
lambda {
|
49
|
-
@set.run_command
|
46
|
+
@set.run_command nil, 'foo'
|
50
47
|
}.should.raise(Pry::NoCommandError)
|
51
48
|
end
|
52
49
|
|
@@ -60,11 +57,11 @@ describe Pry::CommandSet do
|
|
60
57
|
|
61
58
|
@set.import_from(other_set, 'foo')
|
62
59
|
|
63
|
-
@set.run_command
|
60
|
+
@set.run_command nil, 'foo'
|
64
61
|
run.should == true
|
65
62
|
|
66
63
|
lambda {
|
67
|
-
@set.run_command
|
64
|
+
@set.run_command nil, 'bar'
|
68
65
|
}.should.raise(Pry::NoCommandError)
|
69
66
|
end
|
70
67
|
|
@@ -78,8 +75,8 @@ describe Pry::CommandSet do
|
|
78
75
|
|
79
76
|
@set.import other_set
|
80
77
|
|
81
|
-
@set.run_command
|
82
|
-
@set.run_command
|
78
|
+
@set.run_command nil, 'foo'
|
79
|
+
@set.run_command nil, 'bar'
|
83
80
|
run.should == [true, true]
|
84
81
|
end
|
85
82
|
|
@@ -87,7 +84,7 @@ describe Pry::CommandSet do
|
|
87
84
|
run = false
|
88
85
|
@set.command('foo') { run = true }
|
89
86
|
|
90
|
-
Pry::CommandSet.new(@set).run_command
|
87
|
+
Pry::CommandSet.new(@set).run_command nil, 'foo'
|
91
88
|
run.should == true
|
92
89
|
end
|
93
90
|
|
@@ -104,7 +101,7 @@ describe Pry::CommandSet do
|
|
104
101
|
@set.commands['bar'].name.should == 'bar'
|
105
102
|
@set.commands['bar'].description.should == ''
|
106
103
|
|
107
|
-
@set.run_command
|
104
|
+
@set.run_command nil, 'bar'
|
108
105
|
run.should == true
|
109
106
|
end
|
110
107
|
|
@@ -117,17 +114,17 @@ describe Pry::CommandSet do
|
|
117
114
|
|
118
115
|
it 'should return Pry::CommandContext::VOID_VALUE for commands by default' do
|
119
116
|
@set.command('foo') { 3 }
|
120
|
-
@set.run_command(
|
117
|
+
@set.run_command(nil, 'foo').should == Pry::CommandContext::VOID_VALUE
|
121
118
|
end
|
122
119
|
|
123
120
|
it 'should be able to keep return values' do
|
124
121
|
@set.command('foo', '', :keep_retval => true) { 3 }
|
125
|
-
@set.run_command(
|
122
|
+
@set.run_command(nil, 'foo').should == 3
|
126
123
|
end
|
127
124
|
|
128
125
|
it 'should be able to keep return values, even if return value is nil' do
|
129
126
|
@set.command('foo', '', :keep_retval => true) { nil }
|
130
|
-
@set.run_command(
|
127
|
+
@set.run_command(nil, 'foo').should == nil
|
131
128
|
end
|
132
129
|
|
133
130
|
it 'should be able to have its own helpers' do
|
@@ -139,7 +136,7 @@ describe Pry::CommandSet do
|
|
139
136
|
def my_helper; end
|
140
137
|
end
|
141
138
|
|
142
|
-
@set.run_command(
|
139
|
+
@set.run_command(Pry::CommandContext.new, 'foo')
|
143
140
|
Pry::CommandContext.new.should.not.respond_to :my_helper
|
144
141
|
end
|
145
142
|
|
@@ -157,7 +154,7 @@ describe Pry::CommandSet do
|
|
157
154
|
def my_other_helper; end
|
158
155
|
end
|
159
156
|
|
160
|
-
@set.run_command(
|
157
|
+
@set.run_command(Pry::CommandContext.new, 'foo')
|
161
158
|
end
|
162
159
|
|
163
160
|
it 'should import helpers from imported sets' do
|
@@ -169,7 +166,7 @@ describe Pry::CommandSet do
|
|
169
166
|
|
170
167
|
@set.import imported_set
|
171
168
|
@set.command('foo') { should.respond_to :imported_helper_method }
|
172
|
-
@set.run_command(
|
169
|
+
@set.run_command(Pry::CommandContext.new, 'foo')
|
173
170
|
end
|
174
171
|
|
175
172
|
it 'should import helpers even if only some commands are imported' do
|
@@ -183,7 +180,7 @@ describe Pry::CommandSet do
|
|
183
180
|
|
184
181
|
@set.import_from imported_set, 'bar'
|
185
182
|
@set.command('foo') { should.respond_to :imported_helper_method }
|
186
|
-
@set.run_command(
|
183
|
+
@set.run_command(Pry::CommandContext.new, 'foo')
|
187
184
|
end
|
188
185
|
|
189
186
|
it 'should provide a :listing for a command that defaults to its name' do
|
@@ -197,11 +194,12 @@ describe Pry::CommandSet do
|
|
197
194
|
end
|
198
195
|
|
199
196
|
it "should provide a 'help' command" do
|
200
|
-
|
201
|
-
|
197
|
+
context = Pry::CommandContext.new
|
198
|
+
context.command_set = @set
|
199
|
+
context.output = StringIO.new
|
202
200
|
|
203
201
|
lambda {
|
204
|
-
@set.run_command(
|
202
|
+
@set.run_command(context, 'help')
|
205
203
|
}.should.not.raise
|
206
204
|
end
|
207
205
|
|
@@ -211,12 +209,13 @@ describe Pry::CommandSet do
|
|
211
209
|
@set.command 'moo', "Mooerizes" do; end
|
212
210
|
@set.command 'boo', "Booerizes" do; end
|
213
211
|
|
214
|
-
|
215
|
-
|
212
|
+
context = Pry::CommandContext.new
|
213
|
+
context.command_set = @set
|
214
|
+
context.output = StringIO.new
|
216
215
|
|
217
|
-
@set.run_command(
|
216
|
+
@set.run_command(context, 'help')
|
218
217
|
|
219
|
-
doc =
|
218
|
+
doc = context.output.string
|
220
219
|
|
221
220
|
order = [doc.index("boo"),
|
222
221
|
doc.index("foo"),
|
@@ -211,11 +211,36 @@ describe "Pry::DefaultCommands::Introspection" do
|
|
211
211
|
}
|
212
212
|
mock_pry("edit -n").should.not =~ /FOO/
|
213
213
|
end
|
214
|
+
end
|
214
215
|
|
216
|
+
describe "with --in" do
|
215
217
|
it "should edit the nth line of _in_" do
|
216
218
|
mock_pry("10", "11", "edit --in -2")
|
217
219
|
@contents.should == "10\n"
|
218
220
|
end
|
221
|
+
|
222
|
+
it "should edit the last line if no argument is given" do
|
223
|
+
mock_pry("10", "11", "edit --in")
|
224
|
+
@contents.should == "11\n"
|
225
|
+
end
|
226
|
+
|
227
|
+
it "should edit a range of lines if a range is given" do
|
228
|
+
mock_pry("10", "11", "edit -i 1,2")
|
229
|
+
@contents.should == "10\n11\n"
|
230
|
+
end
|
231
|
+
|
232
|
+
it "should edit a multi-line expression as it occupies one line of _in_" do
|
233
|
+
mock_pry("class Fixnum", " def invert; -self; end", "end", "edit -i 1")
|
234
|
+
@contents.should == "class Fixnum\n def invert; -self; end\nend\n"
|
235
|
+
end
|
236
|
+
|
237
|
+
it "should not work with a filename" do
|
238
|
+
mock_pry("edit ruby.rb -i").should =~ /Only one of --ex, --temp, --in and FILE may be specified/
|
239
|
+
end
|
240
|
+
|
241
|
+
it "should not work with nonsense" do
|
242
|
+
mock_pry("edit --in three").should =~ /Not a valid range: three/
|
243
|
+
end
|
219
244
|
end
|
220
245
|
end
|
221
246
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.6.
|
4
|
+
version: 0.9.6.2
|
5
5
|
prerelease:
|
6
6
|
platform: i386-mswin32
|
7
7
|
authors:
|
@@ -13,29 +13,29 @@ date: 2011-09-27 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ruby_parser
|
16
|
-
requirement: &
|
16
|
+
requirement: &70249509038380 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 2.0.5
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70249509038380
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: coderay
|
27
|
-
requirement: &
|
27
|
+
requirement: &70249509034780 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
|
-
- -
|
30
|
+
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 0.9.8
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70249509034780
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: slop
|
38
|
-
requirement: &
|
38
|
+
requirement: &70249509033220 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,32 +43,32 @@ dependencies:
|
|
43
43
|
version: 2.1.0
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70249509033220
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: method_source
|
49
|
-
requirement: &
|
49
|
+
requirement: &70249509173580 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.6.5
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70249509173580
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: bacon
|
60
|
-
requirement: &
|
60
|
+
requirement: &70249509171580 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
|
-
- -
|
63
|
+
- - ~>
|
64
64
|
- !ruby/object:Gem::Version
|
65
65
|
version: 1.1.0
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70249509171580
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: open4
|
71
|
-
requirement: &
|
71
|
+
requirement: &70249509100360 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 1.0.1
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70249509100360
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rake
|
82
|
-
requirement: &
|
82
|
+
requirement: &70249512745240 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,18 +87,18 @@ dependencies:
|
|
87
87
|
version: '0.9'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70249512745240
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: win32console
|
93
|
-
requirement: &
|
93
|
+
requirement: &70249512743620 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
|
-
- -
|
96
|
+
- - ~>
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: 1.3.0
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70249512743620
|
102
102
|
description: An IRB alternative and runtime developer console
|
103
103
|
email: jrmair@gmail.com
|
104
104
|
executables:
|
@@ -156,12 +156,9 @@ files:
|
|
156
156
|
- lib/pry/helpers/text.rb
|
157
157
|
- lib/pry/history.rb
|
158
158
|
- lib/pry/history_array.rb
|
159
|
-
- lib/pry/method.rb
|
160
159
|
- lib/pry/plugins.rb
|
161
160
|
- lib/pry/pry_class.rb
|
162
161
|
- lib/pry/pry_instance.rb
|
163
|
-
- lib/pry/rbx_method.rb
|
164
|
-
- lib/pry/rbx_path.rb
|
165
162
|
- lib/pry/version.rb
|
166
163
|
- pry.gemspec
|
167
164
|
- test/helper.rb
|
@@ -179,7 +176,6 @@ files:
|
|
179
176
|
- test/test_exception_whitelist.rb
|
180
177
|
- test/test_history_array.rb
|
181
178
|
- test/test_input_stack.rb
|
182
|
-
- test/test_method.rb
|
183
179
|
- test/test_pry.rb
|
184
180
|
- test/test_pry_history.rb
|
185
181
|
- test/test_pry_output.rb
|
@@ -227,7 +223,6 @@ test_files:
|
|
227
223
|
- test/test_exception_whitelist.rb
|
228
224
|
- test/test_history_array.rb
|
229
225
|
- test/test_input_stack.rb
|
230
|
-
- test/test_method.rb
|
231
226
|
- test/test_pry.rb
|
232
227
|
- test/test_pry_history.rb
|
233
228
|
- test/test_pry_output.rb
|
data/lib/pry/method.rb
DELETED
@@ -1,184 +0,0 @@
|
|
1
|
-
class Pry
|
2
|
-
class Method
|
3
|
-
include RbxMethod if defined?(RUBY_ENGINE) && RUBY_ENGINE =~ /rbx/
|
4
|
-
|
5
|
-
class << self
|
6
|
-
def from_str(str, target=TOPLEVEL_BINDING, options={})
|
7
|
-
if str.nil?
|
8
|
-
from_binding(target)
|
9
|
-
elsif str.to_s =~ /(\S+)\#(\S+)\Z/
|
10
|
-
context, meth_name = $1, $2
|
11
|
-
from_module(target.eval(context), meth_name)
|
12
|
-
elsif str.to_s =~ /(\S+)\.(\S+)\Z/
|
13
|
-
context, meth_name = $1, $2
|
14
|
-
from_obj(target.eval(context), meth_name)
|
15
|
-
elsif options[:instance]
|
16
|
-
new(target.eval("instance_method(:#{str})")) rescue nil
|
17
|
-
elsif options[:methods]
|
18
|
-
new(target.eval("method(:#{str})")) rescue nil
|
19
|
-
else
|
20
|
-
from_str(str, target, :instance => true) ||
|
21
|
-
from_str(str, target, :methods => true)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def from_binding(b)
|
26
|
-
meth_name = b.eval('__method__')
|
27
|
-
if [:__script__, nil, :__binding__, :__binding_impl__].include?(meth_name)
|
28
|
-
nil
|
29
|
-
else
|
30
|
-
new(b.eval("method(:#{meth_name})"))
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def from_module(nodule, name)
|
35
|
-
new(nodule.instance_method(name)) rescue nil
|
36
|
-
end
|
37
|
-
alias from_class from_module
|
38
|
-
|
39
|
-
def from_obj(obj, name)
|
40
|
-
new(obj.method(name)) rescue nil
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def initialize(method)
|
45
|
-
@method = method
|
46
|
-
end
|
47
|
-
|
48
|
-
def source
|
49
|
-
@source ||= case source_type
|
50
|
-
when :c
|
51
|
-
info = pry_doc_info
|
52
|
-
if info and info.source
|
53
|
-
code = strip_comments_from_c_code(info.source)
|
54
|
-
end
|
55
|
-
when :rbx
|
56
|
-
strip_leading_whitespace(core_code)
|
57
|
-
when :ruby
|
58
|
-
if pry_method?
|
59
|
-
code = Pry.new(:input => StringIO.new(Pry.line_buffer[source_line..-1].join), :prompt => proc {""}, :hooks => {}).r
|
60
|
-
else
|
61
|
-
code = @method.source
|
62
|
-
end
|
63
|
-
strip_leading_whitespace(code)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def doc
|
68
|
-
@doc ||= case source_type
|
69
|
-
when :c
|
70
|
-
info = pry_doc_info
|
71
|
-
info.docstring if info
|
72
|
-
when :rbx
|
73
|
-
strip_leading_hash_and_whitespace_from_ruby_comments(core_doc)
|
74
|
-
when :ruby
|
75
|
-
if pry_method?
|
76
|
-
raise "Error: Can't view doc for a REPL-defined method."
|
77
|
-
else
|
78
|
-
strip_leading_hash_and_whitespace_from_ruby_comments(@method.comment)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
def source_type
|
84
|
-
if defined?(RUBY_ENGINE) && RUBY_ENGINE =~ /rbx/
|
85
|
-
if core? then :rbx else :ruby end
|
86
|
-
else
|
87
|
-
if source_location.nil? then :c else :ruby end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
def source_file
|
92
|
-
source_location.nil? ? nil : source_location.first
|
93
|
-
end
|
94
|
-
|
95
|
-
def source_line
|
96
|
-
source_location.nil? ? nil : source_location.last
|
97
|
-
end
|
98
|
-
|
99
|
-
def visibility
|
100
|
-
if owner.public_instance_methods.include?(name)
|
101
|
-
:public
|
102
|
-
elsif owner.protected_instance_methods.include?(name)
|
103
|
-
:protected
|
104
|
-
elsif owner.private_instance_methods.include?(name)
|
105
|
-
:private
|
106
|
-
else
|
107
|
-
:none
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
# paraphrased from awesome_print gem
|
112
|
-
def signature
|
113
|
-
if respond_to?(:parameters)
|
114
|
-
args = parameters.inject([]) do |arr, (type, name)|
|
115
|
-
name ||= (type == :block ? 'block' : "arg#{arr.size + 1}")
|
116
|
-
arr << case type
|
117
|
-
when :req then name.to_s
|
118
|
-
when :opt, :rest then "*#{name}"
|
119
|
-
when :block then "&#{name}"
|
120
|
-
else '?'
|
121
|
-
end
|
122
|
-
end
|
123
|
-
else
|
124
|
-
args = (1..arity.abs).map { |i| "arg#{i}" }
|
125
|
-
args[-1] = "*#{args[-1]}" if arity < 0
|
126
|
-
end
|
127
|
-
|
128
|
-
"#{name}(#{args.join(', ')})"
|
129
|
-
end
|
130
|
-
|
131
|
-
def dynamically_defined?
|
132
|
-
source_file ? !!(source_file =~ /(\(.*\))|<.*>/) : nil
|
133
|
-
end
|
134
|
-
|
135
|
-
def pry_method?
|
136
|
-
source_file == Pry.eval_path
|
137
|
-
end
|
138
|
-
|
139
|
-
def ==(obj)
|
140
|
-
if obj.is_a? Pry::Method
|
141
|
-
super
|
142
|
-
else
|
143
|
-
@method == obj
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
def is_a?(klass)
|
148
|
-
klass == Pry::Method or @method.is_a?(klass)
|
149
|
-
end
|
150
|
-
alias kind_of? is_a?
|
151
|
-
|
152
|
-
def respond_to?(method_name)
|
153
|
-
super or @method.respond_to?(method_name)
|
154
|
-
end
|
155
|
-
|
156
|
-
def method_missing(method_name, *args, &block)
|
157
|
-
@method.send(method_name, *args, &block)
|
158
|
-
end
|
159
|
-
|
160
|
-
private
|
161
|
-
def pry_doc_info
|
162
|
-
if Pry.config.has_pry_doc
|
163
|
-
Pry::MethodInfo.info_for(@method) or output.puts "Cannot find C method: #{name}"
|
164
|
-
else
|
165
|
-
output.puts "Cannot locate this method: #{name}. Try `gem install pry-doc` to get access to Ruby Core documentation."
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
def strip_comments_from_c_code(code)
|
170
|
-
code.sub(/\A\s*\/\*.*?\*\/\s*/m, '')
|
171
|
-
end
|
172
|
-
|
173
|
-
def strip_leading_hash_and_whitespace_from_ruby_comments(comment)
|
174
|
-
comment = comment.dup
|
175
|
-
comment.gsub!(/\A\#+?$/, '')
|
176
|
-
comment.gsub!(/^\s*#/, '')
|
177
|
-
strip_leading_whitespace(comment)
|
178
|
-
end
|
179
|
-
|
180
|
-
def strip_leading_whitespace(text)
|
181
|
-
Pry::Helpers::CommandHelpers.unindent(text)
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|