engines/adva_cms/vendor/plugins/cache_references/lib/cache_references/method_call_tracking.rb
# Sets up a method in the meta class of the target object which will save
# a reference when the method is called first, then removes itself and
# delegates to the regular method in the class. (Cheap method proxy pattern
# that leverages Ruby's way of looking up a method in the meta class first
# and then in the regular class second.)    
Sets up a method in the meta class of the target object which will save
a reference when the method is called first, then removes itself and
delegates to the regular method in the class. (Cheap method proxy pattern
that leverages Ruby's way of looking up a method in the meta class first
and then in the regular class second.)
Sets up a method in the meta class of the target object which will save a reference when the method is called first then removes itself and delegates to the regular method in the class . ( Cheap method proxy pattern that leverages Ruby ' s way of looking up a method in the meta class first and then in the regular class second . )
def define_track_method(tracker, target, method, reference)
      meta_class = class << target; self; end
      meta_class.send :define_method, method do |*args|
        tracker << reference
        meta_class.send :remove_method, method
        super
      end
    end
def define_track_method ( tracker , target , method , reference ) meta_class = class << target ; self ; end meta_class . send :define_method , method do | * args | tracker << reference meta_class . send :remove_method , method super end end
Sets up a method in the meta class of the target object which will save
a reference when the method is called first, then removes itself and
delegates to the regular method in the class.
Sets up a method in the meta class of the target object which will save a reference when the method is called first then removes itself and delegates to the regular method in the class .
tracker
target
method
reference