pry-moves 0.1.13 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +6 -4
- data/README.md +15 -7
- data/lib/commands/debug.rb +17 -0
- data/lib/commands/finish.rb +26 -0
- data/lib/commands/goto.rb +19 -0
- data/lib/commands/iterate.rb +22 -0
- data/lib/commands/next.rb +37 -0
- data/lib/commands/next_breakpoint.rb +22 -0
- data/lib/commands/step.rb +83 -0
- data/lib/commands/trace_command.rb +87 -0
- data/lib/commands/trace_helpers.rb +49 -0
- data/lib/commands/traced_method.rb +71 -0
- data/lib/debug_sugar.rb +72 -0
- data/lib/pry-moves/add_suffix.rb +88 -0
- data/lib/pry-moves/backtrace.rb +67 -43
- data/lib/pry-moves/bindings_stack.rb +97 -0
- data/lib/pry-moves/commands.rb +42 -3
- data/lib/pry-moves/formatter.rb +74 -0
- data/lib/pry-moves/painter.rb +3 -2
- data/lib/pry-moves/pry_ext.rb +64 -16
- data/lib/pry-moves/pry_wrapper.rb +30 -17
- data/lib/pry-moves/restartable.rb +38 -0
- data/lib/pry-moves/version.rb +1 -1
- data/lib/pry-moves/watch.rb +3 -0
- data/lib/pry-moves.rb +65 -6
- data/lib/pry-stack_explorer/frame_manager.rb +6 -9
- data/lib/pry-stack_explorer/pry-stack_explorer.rb +1 -16
- data/lib/pry-stack_explorer/{commands.rb → stack_commands.rb} +10 -6
- data/lib/pry-stack_explorer/when_started_hook.rb +10 -65
- data/playground/Gemfile.lock +6 -4
- data/playground/README.md +1 -0
- data/playground/playground.rb +94 -9
- data/playground/test.rb +5 -1
- data/playground/test.sh +1 -0
- data/pry-moves.gemspec +3 -2
- data/publish.sh +2 -1
- data/spec/backtrace_spec.rb +11 -13
- data/spec/blocks_spec.rb +41 -8
- data/spec/commands_spec.rb +26 -25
- data/spec/pry_debugger.rb +5 -1
- data/spec/redirection_spec.rb +7 -0
- data/spec/spec_helper.rb +9 -4
- data/spec/step_spec.rb +51 -0
- metadata +43 -13
- data/lib/pry-moves/helpers.rb +0 -56
- data/lib/pry-moves/trace_commands.rb +0 -109
- data/lib/pry-moves/traced_method.rb +0 -61
- data/lib/pry-moves/tracer.rb +0 -140
- data/lib/pry-moves/traversing.rb +0 -69
data/spec/blocks_spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe 'blocks' do
|
|
5
5
|
it 'should go next over blocks' do
|
6
6
|
breakpoints [
|
7
7
|
[nil, 'stop in zaloop'],
|
8
|
-
['n', ''],
|
8
|
+
['n', 'iterator line'],
|
9
9
|
# repeat commands
|
10
10
|
['', 'inside block'],
|
11
11
|
['', nil],
|
@@ -15,11 +15,10 @@ describe 'blocks' do
|
|
15
15
|
['', 'inside block'],
|
16
16
|
['pass', {output: '=> 0'}],
|
17
17
|
|
18
|
-
['f', '
|
19
|
-
['
|
18
|
+
['f', 'iterator line'],
|
19
|
+
['f', 'after sub-zaloop'],
|
20
|
+
['pass', {output: '=> :root'}],
|
20
21
|
|
21
|
-
['f', 'post_yield'], # Тут хорошо бы, чтобы сразу шёл на "after block",
|
22
|
-
# но пока и не понятно, как это угадать
|
23
22
|
['f', 'after block'],
|
24
23
|
['pass', {output: '=> :root'}],
|
25
24
|
]
|
@@ -39,7 +38,7 @@ describe 'blocks' do
|
|
39
38
|
it 'should finish block with sub-calls' do
|
40
39
|
breakpoints [
|
41
40
|
[nil, 'stop in zaloop'],
|
42
|
-
['n', ''],
|
41
|
+
['n', 'iterator line'],
|
43
42
|
['', 'inside block'],
|
44
43
|
['f', 'after block'],
|
45
44
|
['pass', {output: '=> :root'}],
|
@@ -79,7 +78,7 @@ describe 'blocks' do
|
|
79
78
|
['n', 'iterator line'],
|
80
79
|
['n', 'inside block'],
|
81
80
|
['iterate', 'iterator line'],
|
82
|
-
['n', 'exit']
|
81
|
+
['n', 'exit']
|
83
82
|
]
|
84
83
|
Playground.new.native_block early_return: true
|
85
84
|
:exit # exit
|
@@ -91,10 +90,44 @@ describe 'blocks' do
|
|
91
90
|
['n', 'iterator line'],
|
92
91
|
['n', 'inside block'],
|
93
92
|
['iterate', 'iterator line'],
|
94
|
-
['n', 'exit']
|
93
|
+
['n', 'exit']
|
95
94
|
]
|
96
95
|
Playground.new.nested_block early_return: true
|
97
96
|
:exit # exit
|
98
97
|
end
|
98
|
+
|
99
|
+
it 'should iterate over one-line in block' do
|
100
|
+
breakpoints [
|
101
|
+
[nil, 'stop in one_line_in_block'],
|
102
|
+
['n', 'iterator line'],
|
103
|
+
['n', 'inside block'],
|
104
|
+
['i', {output: '=> 0'}],
|
105
|
+
['n', 'inside block'],
|
106
|
+
['i', {output: '=> 1'}],
|
107
|
+
['n', 'after block'],
|
108
|
+
]
|
109
|
+
Playground.new.one_line_in_block
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'should skip one-line block' do
|
113
|
+
breakpoints [
|
114
|
+
[nil, 'stop in one_line_block'],
|
115
|
+
['n', 'iterator line'],
|
116
|
+
['n', 'after block']
|
117
|
+
]
|
118
|
+
Playground.new.one_line_block
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'should skip parentheses in loop' do
|
122
|
+
breakpoints [
|
123
|
+
[nil, 'stop in parentheses_in_loop'],
|
124
|
+
['n', nil],
|
125
|
+
['n', 'iterator line'],
|
126
|
+
['n', 'inside block'],
|
127
|
+
['n', 'iterator line'],
|
128
|
+
['n', 'after block']
|
129
|
+
]
|
130
|
+
Playground.new.parentheses_in_loop
|
131
|
+
end
|
99
132
|
|
100
133
|
end
|
data/spec/commands_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require_relative 'spec_helper'
|
|
2
2
|
|
3
3
|
describe 'PryMoves commands' do
|
4
4
|
|
5
|
-
it 'should make one
|
5
|
+
it 'should make one move next' do
|
6
6
|
breakpoints [
|
7
7
|
[nil, 'basic next stop'],
|
8
8
|
['n', 'next step'],
|
@@ -10,7 +10,7 @@ describe 'PryMoves commands' do
|
|
10
10
|
Playground.new.basic_next
|
11
11
|
end
|
12
12
|
|
13
|
-
it 'should stop on second
|
13
|
+
it 'should stop on second binding.pry' do
|
14
14
|
breakpoints [
|
15
15
|
[nil, 'first stop'],
|
16
16
|
['c', 'second stop'],
|
@@ -18,37 +18,19 @@ describe 'PryMoves commands' do
|
|
18
18
|
Playground.new.continue
|
19
19
|
end
|
20
20
|
|
21
|
-
it 'should
|
21
|
+
it 'should walk over stack' do
|
22
22
|
breakpoints [
|
23
23
|
[nil, 'step_into stop'],
|
24
24
|
['s', 'point to step inside'],
|
25
25
|
['s', 'some internal line'],
|
26
26
|
['up', 'point to step inside'],
|
27
|
-
['up',
|
28
|
-
['up', {output_includes: 'top of stack'} ],
|
29
|
-
['down',
|
27
|
+
['up', 'spec example beginning' ],
|
28
|
+
#['up', {output_includes: 'top of stack'} ],
|
29
|
+
['down', 'point to step inside'],
|
30
30
|
['down', 'some internal line'],
|
31
31
|
['down', {output_includes: 'bottom of stack'} ],
|
32
32
|
]
|
33
|
-
Playground.new.step_into
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'should step into func by name' do
|
37
|
-
breakpoints [
|
38
|
-
[nil, 'stop in step_by_name'],
|
39
|
-
['s level_c', 'stop in level_c'],
|
40
|
-
['param', {output: '=> :target'}],
|
41
|
-
['n', nil],
|
42
|
-
]
|
43
|
-
Playground.new.step_by_name
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'should stop after inability to step into func by name' do
|
47
|
-
breakpoints [
|
48
|
-
[nil, 'stop in step_by_name'],
|
49
|
-
['s absent_function', 'after_step_by_name'],
|
50
|
-
]
|
51
|
-
Playground.new.step_by_name_wrap
|
33
|
+
Playground.new.step_into # spec example beginning
|
52
34
|
end
|
53
35
|
|
54
36
|
it 'should go next over recursion calls' do
|
@@ -61,6 +43,15 @@ describe 'PryMoves commands' do
|
|
61
43
|
Playground.new.recursion
|
62
44
|
end
|
63
45
|
|
46
|
+
it 'should stop after finishing early return' do
|
47
|
+
breakpoints [
|
48
|
+
[nil, 'stop in level_c'],
|
49
|
+
['f', 'at early return'],
|
50
|
+
['f', 'after early return']
|
51
|
+
]
|
52
|
+
Playground.new.early_return_wrap
|
53
|
+
end
|
54
|
+
|
64
55
|
it 'should debug' do
|
65
56
|
breakpoints [
|
66
57
|
[nil, 'basic next stop'],
|
@@ -70,4 +61,14 @@ describe 'PryMoves commands' do
|
|
70
61
|
Playground.new.basic_next
|
71
62
|
end
|
72
63
|
|
64
|
+
it 'should next breakpoint' do
|
65
|
+
breakpoints [
|
66
|
+
[nil, 'method_with_breakpoints host'],
|
67
|
+
['b', 'breakpoint'],
|
68
|
+
['n', 'after breakpoint'],
|
69
|
+
['b', 'breakpoint 2']
|
70
|
+
]
|
71
|
+
Playground.new.method_with_breakpoints
|
72
|
+
end
|
73
|
+
|
73
74
|
end
|
data/spec/pry_debugger.rb
CHANGED
@@ -24,13 +24,17 @@ module PryDebugger
|
|
24
24
|
|
25
25
|
def compare(step, label, binding_, output)
|
26
26
|
exp = step[:expected]
|
27
|
+
puts "\nSTEP #{step[:index]}:\n#{output}" if ENV['PRINT']
|
27
28
|
if exp.is_a? Proc
|
28
29
|
exp.call binding_, output
|
29
30
|
elsif exp.is_a? Hash
|
30
31
|
if exp[:output_includes]
|
31
32
|
expect(output).to include exp[:output_includes]
|
32
33
|
else
|
33
|
-
|
34
|
+
err = <<-TEXT
|
35
|
+
[#{step[:index]}] #{step[:cmd]} expected output '#{exp[:output]}', got '#{output}'
|
36
|
+
TEXT
|
37
|
+
expect(output).to eq(exp[:output]), err
|
34
38
|
end
|
35
39
|
elsif not exp.nil?
|
36
40
|
err = <<-TEXT
|
data/spec/redirection_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
$VERBOSE = nil # Disable warnings for whole specs
|
2
|
+
|
1
3
|
require 'pry'
|
2
4
|
require_relative 'pry_debugger'
|
3
5
|
require_relative '../playground/playground.rb'
|
@@ -14,7 +16,8 @@ RSpec.configure do |config|
|
|
14
16
|
|
15
17
|
config.after(:example) do |example|
|
16
18
|
unless example.exception
|
17
|
-
expect(PryDebugger.breakpoints.count).to be(0),
|
19
|
+
expect(PryDebugger.breakpoints.count).to be(0),
|
20
|
+
"not all breakpoints launched: #{PryDebugger.breakpoints.count}"
|
18
21
|
end
|
19
22
|
end
|
20
23
|
|
@@ -34,9 +37,11 @@ RSpec::Core::BacktraceFormatter.class_eval do
|
|
34
37
|
|
35
38
|
FILTER = /(\/gems\/|\/lib\/pry\/|spec\/pry_debugger\.rb)/
|
36
39
|
def backtrace_line(line)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
+
unless ENV['TRACE']
|
41
|
+
return if @lines == 3
|
42
|
+
#return if line.match FILTER
|
43
|
+
return unless line.include? '/playground.rb'
|
44
|
+
end
|
40
45
|
|
41
46
|
result = native_backtrace_line(line)
|
42
47
|
if result
|
data/spec/step_spec.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
|
3
|
+
describe 'step' do
|
4
|
+
|
5
|
+
it 'should step into func by name' do
|
6
|
+
breakpoints [
|
7
|
+
[nil, 'stop in step_by_name'],
|
8
|
+
['s level_c', 'stop in level_c'],
|
9
|
+
['param', {output: '=> :target'}],
|
10
|
+
['n', nil],
|
11
|
+
]
|
12
|
+
Playground.new.step_by_name
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should stop after inability to step into func by name' do
|
16
|
+
breakpoints [
|
17
|
+
[nil, 'stop in step_by_name'],
|
18
|
+
['s absent_function', 'after_step_by_name'],
|
19
|
+
]
|
20
|
+
Playground.new.step_by_name_wrap
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should skip hidden frames' do
|
24
|
+
breakpoints [
|
25
|
+
[nil, 'skip_hidden_impl stop'],
|
26
|
+
['s', 'point to step inside'],
|
27
|
+
['s', 'some internal line']
|
28
|
+
]
|
29
|
+
Playground.new.skip_hidden_impl
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should step down to hidden frame and resume there' do
|
33
|
+
breakpoints [
|
34
|
+
[nil, 'at root'],
|
35
|
+
['down', 'hidden stop'],
|
36
|
+
['n', 'hidden_stop for next'],
|
37
|
+
['s', 'hidden_stop for step']
|
38
|
+
]
|
39
|
+
Playground.new.hidden_stop # at root
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should skip hidden method' do
|
43
|
+
breakpoints [
|
44
|
+
[nil, 'stop in skip_test'],
|
45
|
+
['n', 'next step'],
|
46
|
+
['s', 'at not_skipped_method']
|
47
|
+
]
|
48
|
+
Playground.new.skip_test
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-moves
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- garmoshka-mo
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: 0.10.4
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
22
|
+
version: '0.13'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: 0.10.4
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.
|
32
|
+
version: '0.13'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: binding_of_caller
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,6 +44,20 @@ dependencies:
|
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0.7'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: colorize
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0.8'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0.8'
|
47
61
|
- !ruby/object:Gem::Dependency
|
48
62
|
name: pry-remote
|
49
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,25 +86,35 @@ files:
|
|
72
86
|
- README.md
|
73
87
|
- Rakefile
|
74
88
|
- dynamic_debug_experiments.rb
|
89
|
+
- lib/commands/debug.rb
|
90
|
+
- lib/commands/finish.rb
|
91
|
+
- lib/commands/goto.rb
|
92
|
+
- lib/commands/iterate.rb
|
93
|
+
- lib/commands/next.rb
|
94
|
+
- lib/commands/next_breakpoint.rb
|
95
|
+
- lib/commands/step.rb
|
96
|
+
- lib/commands/trace_command.rb
|
97
|
+
- lib/commands/trace_helpers.rb
|
98
|
+
- lib/commands/traced_method.rb
|
99
|
+
- lib/debug_sugar.rb
|
75
100
|
- lib/pry-moves.rb
|
101
|
+
- lib/pry-moves/add_suffix.rb
|
76
102
|
- lib/pry-moves/backtrace.rb
|
103
|
+
- lib/pry-moves/bindings_stack.rb
|
77
104
|
- lib/pry-moves/cli.rb
|
78
105
|
- lib/pry-moves/commands.rb
|
79
|
-
- lib/pry-moves/
|
106
|
+
- lib/pry-moves/formatter.rb
|
80
107
|
- lib/pry-moves/painter.rb
|
81
108
|
- lib/pry-moves/pry_ext.rb
|
82
109
|
- lib/pry-moves/pry_remote_ext.rb
|
83
110
|
- lib/pry-moves/pry_wrapper.rb
|
84
|
-
- lib/pry-moves/
|
85
|
-
- lib/pry-moves/traced_method.rb
|
86
|
-
- lib/pry-moves/tracer.rb
|
87
|
-
- lib/pry-moves/traversing.rb
|
111
|
+
- lib/pry-moves/restartable.rb
|
88
112
|
- lib/pry-moves/version.rb
|
89
113
|
- lib/pry-moves/watch.rb
|
90
114
|
- lib/pry-stack_explorer/VERSION
|
91
|
-
- lib/pry-stack_explorer/commands.rb
|
92
115
|
- lib/pry-stack_explorer/frame_manager.rb
|
93
116
|
- lib/pry-stack_explorer/pry-stack_explorer.rb
|
117
|
+
- lib/pry-stack_explorer/stack_commands.rb
|
94
118
|
- lib/pry-stack_explorer/when_started_hook.rb
|
95
119
|
- playground/Gemfile
|
96
120
|
- playground/Gemfile.lock
|
@@ -100,6 +124,7 @@ files:
|
|
100
124
|
- playground/recursions.rb
|
101
125
|
- playground/sand.rb
|
102
126
|
- playground/test.rb
|
127
|
+
- playground/test.sh
|
103
128
|
- playground/threads.rb
|
104
129
|
- playground/tracer.rb
|
105
130
|
- pry-moves.gemspec
|
@@ -110,11 +135,12 @@ files:
|
|
110
135
|
- spec/pry_debugger.rb
|
111
136
|
- spec/redirection_spec.rb
|
112
137
|
- spec/spec_helper.rb
|
138
|
+
- spec/step_spec.rb
|
113
139
|
homepage: https://github.com/garmoshka-mo/pry-moves
|
114
140
|
licenses:
|
115
141
|
- MIT
|
116
142
|
metadata: {}
|
117
|
-
post_install_message:
|
143
|
+
post_install_message:
|
118
144
|
rdoc_options: []
|
119
145
|
require_paths:
|
120
146
|
- lib
|
@@ -123,6 +149,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
149
|
- - ">="
|
124
150
|
- !ruby/object:Gem::Version
|
125
151
|
version: 1.8.7
|
152
|
+
- - "<"
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '3'
|
126
155
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
156
|
requirements:
|
128
157
|
- - ">="
|
@@ -130,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
159
|
version: '0'
|
131
160
|
requirements: []
|
132
161
|
rubygems_version: 3.1.2
|
133
|
-
signing_key:
|
162
|
+
signing_key:
|
134
163
|
specification_version: 4
|
135
164
|
summary: Debugger for ruby
|
136
165
|
test_files:
|
@@ -140,3 +169,4 @@ test_files:
|
|
140
169
|
- spec/pry_debugger.rb
|
141
170
|
- spec/redirection_spec.rb
|
142
171
|
- spec/spec_helper.rb
|
172
|
+
- spec/step_spec.rb
|
data/lib/pry-moves/helpers.rb
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
module PryMoves::Helpers
|
2
|
-
|
3
|
-
extend self
|
4
|
-
|
5
|
-
# @return [String] Signature for the method object in Class#method format.
|
6
|
-
def method_signature_with_owner(binding)
|
7
|
-
meth = binding.eval('__method__')
|
8
|
-
meth_obj = meth ? Pry::Method.from_binding(binding) : nil
|
9
|
-
if !meth_obj
|
10
|
-
""
|
11
|
-
elsif meth_obj.undefined?
|
12
|
-
"#{meth_obj.name_with_owner}(UNKNOWN) (undefined method)"
|
13
|
-
else
|
14
|
-
args = meth_obj.parameters.inject([]) do |arr, (type, name)|
|
15
|
-
name ||= (type == :block ? 'block' : "arg#{arr.size + 1}")
|
16
|
-
arr << case type
|
17
|
-
when :req then name.to_s
|
18
|
-
when :opt then "#{name}=?"
|
19
|
-
when :rest then "*#{name}"
|
20
|
-
when :block then "&#{name}"
|
21
|
-
else '?'
|
22
|
-
end
|
23
|
-
end
|
24
|
-
"#{meth_obj.name_with_owner}(#{args.join(', ')})"
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def method_signature(binding)
|
29
|
-
meth = binding.eval('__method__')
|
30
|
-
meth_obj = meth ? Pry::Method.from_binding(binding) : nil
|
31
|
-
if !meth_obj
|
32
|
-
""
|
33
|
-
elsif meth_obj.undefined?
|
34
|
-
"#{meth_obj.name}(UNKNOWN) (undefined method)"
|
35
|
-
else
|
36
|
-
args = meth_obj.parameters.inject([]) do |arr, (type, name)|
|
37
|
-
name ||= (type == :block ? 'block' : "arg#{arr.size + 1}")
|
38
|
-
arr << case type
|
39
|
-
when :req then name.to_s
|
40
|
-
when :opt then "#{name}=?"
|
41
|
-
when :rest then "*#{name}"
|
42
|
-
when :block then "&#{name}"
|
43
|
-
else '?'
|
44
|
-
end
|
45
|
-
end
|
46
|
-
"#{meth_obj.name}(#{args.join(', ')})"
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
PATH_TRASH = defined?(Rails) ? Rails.root.to_s : Dir.pwd
|
51
|
-
|
52
|
-
def shorten_path(path)
|
53
|
-
path.gsub( /^#{PATH_TRASH}\//, '')
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|