Class: Serega::AttributeValueResolvers::Delegate
- Inherits:
-
Object
- Object
- Serega::AttributeValueResolvers::Delegate
- Defined in:
- lib/serega/attribute_value_resolvers/delegate.rb
Overview
Value resolver class for attributes with :delegate (without :allow_nil) option
Instance Method Summary collapse
-
#call(object) ⇒ Object
Delegates method call to another object.
-
#initialize(delegate_to, method_name) ⇒ Delegate
constructor
A new instance of Delegate.
Constructor Details
#initialize(delegate_to, method_name) ⇒ Delegate
Returns a new instance of Delegate.
53 54 55 56 |
# File 'lib/serega/attribute_value_resolvers/delegate.rb', line 53 def initialize(delegate_to, method_name) @delegate_to = delegate_to @method_name = method_name end |
Instance Method Details
#call(object) ⇒ Object
Delegates method call to another object
64 65 66 |
# File 'lib/serega/attribute_value_resolvers/delegate.rb', line 64 def call(object) object.public_send(@delegate_to).public_send(@method_name) end |