Module: ActiveRecord::Chemistry::Extendable::InstanceMethods

Defined in:
lib/activerecord/chemistry/extendable/instance_methods.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/activerecord/chemistry/extendable/instance_methods.rb', line 26

def method_missing(method, *args, &block)
  if !self_respond_to?(method) && extendable.respond_to?(method)
    extendable.send(method, *args, &block)
  else
    super
  end
end

Instance Method Details

#respond_to?(name, include_private = false, as_original_class = false) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
18
19
20
# File 'lib/activerecord/chemistry/extendable/instance_methods.rb', line 14

def respond_to?(name, include_private = false, as_original_class = false)
  if as_original_class
    super(name, include_private)
  else
    super(name, include_private) || extendable.respond_to?(name)
  end
end

#self_respond_to?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/activerecord/chemistry/extendable/instance_methods.rb', line 22

def self_respond_to?(name, include_private = false)
  respond_to? name, include_private, true
end