module Draper::AutomaticDelegation
Public Instance Methods
method_missing(method, *args, &block)
click to toggle source
Delegates missing instance methods to the source object.
Calls superclass method
# File lib/draper/automatic_delegation.rb, line 6 def method_missing(method, *args, &block) return super unless delegatable?(method) self.class.delegate method send(method, *args, &block) end
respond_to_missing?(method, include_private = false)
click to toggle source
Checks if the decorator responds to an instance method, or is able to proxy it to the source object.
Calls superclass method
# File lib/draper/automatic_delegation.rb, line 15 def respond_to_missing?(method, include_private = false) super || delegatable?(method) end
Private Instance Methods
delegatable?(method)
click to toggle source
@private
# File lib/draper/automatic_delegation.rb, line 20 def delegatable?(method) object.respond_to?(method) end