Module: DeepCover::Node::Mixin::HasTracker::ClassMethods

Defined in:
lib/deep_cover/node/mixin/has_tracker.rb

Instance Method Summary collapse

Instance Method Details

#has_tracker(name) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/deep_cover/node/mixin/has_tracker.rb', line 28

def has_tracker(name)
  i = self::TRACKERS[name] = self::TRACKERS.size
  class_eval <<-EVAL, __FILE__, __LINE__ + 1
    def #{name}_tracker_source
      covered_code.increment_tracker_source(@tracker_offset + #{i})
    end
    def #{name}_tracker_hits
      covered_code.tracker_hits[@tracker_offset + #{i}]
    end
  EVAL
end

#inherited(base) ⇒ Object



23
24
25
26
# File 'lib/deep_cover/node/mixin/has_tracker.rb', line 23

def inherited(base)
  base.const_set :TRACKERS, self::TRACKERS.dup
  super
end