Class: PryMoves::Step
Instance Method Summary
collapse
#initialize, #start_tracing, #stop_tracing, trace, #trace_obj, #traced_method?, #tracing_func
#current_frame_digest, #current_frame_type, #debug_info, #frame_digest, #frame_type, #redirect_step?
Instance Method Details
#init(binding_) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/commands/step.rb', line 3
def init(binding_)
@step_into_funcs = nil
@start_line = binding_.eval('__LINE__')
@caller_digest = frame_digest(binding_)
func = @command[:param]
redirect_step? binding_ if func == '+'
PryMoves.step_in_everywhere = true
elsif func
@find_straight_descendant = true
@step_into_funcs = [func]
@step_into_funcs << '=initialize' if ['new', '=new'].include? func
end
end
|
#keep_search_method?(binding_) ⇒ Boolean
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/commands/step.rb', line 59
def keep_search_method? binding_
return true unless method_matches? binding_.eval('__callee__')
return true if @find_straight_descendant &&
@caller_digest != current_frame_digest(upward: 1 + 1) @find_straight_descendant = false
return true if redirect_step? binding_
end
|
#method_matches?(method) ⇒ Boolean
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/commands/step.rb', line 70
def method_matches?(method)
@step_into_funcs.any? do |pattern|
if pattern.is_a? Symbol
method == pattern
elsif pattern.is_a? Regexp
method.to_s.match pattern
elsif pattern.start_with? '='
"=#{method}" == pattern
else
method.to_s.include? pattern
end
end
end
|
#trace(event, file, line, method, binding_) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/commands/step.rb', line 18
def trace(event, file, line, method, binding_)
if binding_.local_variable_defined? :pry_moves_skip
finish_cmd = {binding: binding_}
stop_tracing
PryMoves::Finish.new finish_cmd, @pry_start_options do |binding|
start_tracing
end
return
end
@const_missing_level ||= 0
if method == :const_missing
if event == 'call'
@const_missing_level += 1
elsif event == 'return'
@const_missing_level -= 1
end
end
return if @const_missing_level > 0
return unless event == 'line'
if PryMoves.step_in_everywhere
return true
elsif @step_into_funcs
if @call_depth < 0
PryMoves.messages << "⚠️ Unable to find function with name #{@step_into_funcs.join(',')}"
return true
end
return false if keep_search_method? binding_
elsif redirect_step? binding_
return false
elsif binding_.local_variable_defined? :hide_from_stack and
not @method.within?(file, line, method)
return false
end
true
end
|