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



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/deep_cover/node/mixin/has_tracker.rb', line 32

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

#inherited(base) ⇒ Object



27
28
29
30
# File 'lib/deep_cover/node/mixin/has_tracker.rb', line 27

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