Class: Attrio::DefaultValue::Symbol
- Defined in:
- lib/attrio/default_value/symbol.rb
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#call(instance) ⇒ Object
Evaluates the value via self.object#send(value) Symbol value is returned if the object doesn’t respond to value.
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/symbol.rb', line 8 def self.handle?(value) value.is_a?(::Symbol) end |
Instance Method Details
#call(instance) ⇒ Object
Evaluates the value via self.object#send(value) Symbol value is returned if the object doesn’t respond to value
17 18 19 |
# File 'lib/attrio/default_value/symbol.rb', line 17 def call(instance) instance.respond_to?(self.value, true) ? instance.send(self.value) : self.value end |