Class: Attrio::DefaultValue::Callable
- Defined in:
- lib/attrio/default_value/callable.rb
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#call(instance) ⇒ Object
Evaluates the value via value#call.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Attrio::DefaultValue::Base
Class Method Details
.handle?(value) ⇒ Boolean
8 9 10 |
# File 'lib/attrio/default_value/callable.rb', line 8 def self.handle?(value) value.respond_to?(:call) end |
Instance Method Details
#call(instance) ⇒ Object
Evaluates the value via value#call
18 19 20 |
# File 'lib/attrio/default_value/callable.rb', line 18 def call(instance) self.value.call(instance, self.attribute) end |