class CodeMapper::Filter::StartAt
Public Class Methods
new(start_matcher)
click to toggle source
# File lib/code_mapper/filter/start_at.rb, line 4 def initialize(start_matcher) @start_matcher = start_matcher @started = false @stack = [] end
Public Instance Methods
keep?(tp, normalized_class_name)
click to toggle source
# 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
Private Instance Methods
call_event?(tp)
click to toggle source
# File lib/code_mapper/filter/start_at.rb, line 35 def call_event?(tp) tp.event == :call || tp.event == :c_call end
matches?(class_and_method)
click to toggle source
# File lib/code_mapper/filter/start_at.rb, line 43 def matches?(class_and_method) case @start_matcher when Regexp (@start_matcher =~ class_and_method) != nil when String @start_matcher == class_and_method end end
return_event?(tp)
click to toggle source
# File lib/code_mapper/filter/start_at.rb, line 39 def return_event?(tp) tp.event == :return || tp.event == :c_return end