Module: Extlib::Hook::ClassMethods

Extended by:
LocalObjectSpace
Defined in:
lib/rails_dm_datastore/extlib.rb

Instance Method Summary collapse

Methods included from LocalObjectSpace

extended, object_by_id

Instance Method Details

#inline_call(method_info, scope) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/rails_dm_datastore/extlib.rb', line 6

def inline_call(method_info, scope)
  Extlib::Hook::ClassMethods.hook_scopes << method_info[:from]
  name = method_info[:name]
  if scope == :instance
    args = method_defined?(name) && instance_method(name).arity != 0 ? '*args' : ''
    %(#{name}(#{args}) if self.class <= Extlib::Hook::ClassMethods.object_by_id(#{method_info[:from].object_id}))
  else
    args = respond_to?(name) && method(name).arity != 0 ? '*args' : ''
    %(#{name}(#{args}) if self <= Extlib::Hook::ClassMethods.object_by_id(#{method_info[:from].object_id}))
  end
end