Module: Draper::AutomaticDelegation::ClassMethods

Defined in:
lib/draper/automatic_delegation.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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

Proxies missing class methods to the source class.



26
27
28
29
30
# File 'lib/draper/automatic_delegation.rb', line 26

def method_missing(method, *args, &block)
  return super unless delegatable?(method)

  object_class.send(method, *args, &block)
end

Instance Method Details

#respond_to_missing?(method, include_private = false) ⇒ Boolean

Checks if the decorator responds to a class method, or is able to proxy it to the source class.

Returns:

  • (Boolean)


34
35
36
# File 'lib/draper/automatic_delegation.rb', line 34

def respond_to_missing?(method, include_private = false)
  super || delegatable?(method)
end