Class: CodeMapper::Filter::StartAt
- Inherits:
-
Object
- Object
- CodeMapper::Filter::StartAt
- Defined in:
- lib/code_mapper/filter/start_at.rb
Instance Method Summary collapse
-
#initialize(start_matcher) ⇒ StartAt
constructor
A new instance of StartAt.
- #keep?(tp, normalized_class_name) ⇒ Boolean
Constructor Details
#initialize(start_matcher) ⇒ StartAt
Returns a new instance of StartAt.
4 5 6 7 8 |
# File 'lib/code_mapper/filter/start_at.rb', line 4 def initialize(start_matcher) @start_matcher = start_matcher @started = false @stack = [] end |
Instance Method Details
#keep?(tp, normalized_class_name) ⇒ Boolean
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/code_mapper/filter/start_at.rb', line 10 def keep?(tp, normalized_class_name) class_and_method = "#{normalized_class_name}.#{tp.method_id}" if !@started && call_event?(tp) && matches?(class_and_method) @started = true end if @started && call_event?(tp) @stack << class_and_method return true end if @started && return_event?(tp) @stack.pop if @stack.empty? @started = false end end @started end |