Class: Attrio::DefaultValue::Clonable
- Defined in:
- lib/attrio/default_value/clonable.rb
Constant Summary collapse
- SINGLETON_CLASSES =
[::NilClass, ::TrueClass, ::FalseClass, ::Numeric, ::Symbol ].freeze
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#call ⇒ Object
Evaluates the value via value#clone.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Attrio::DefaultValue::Base
Class Method Details
.handle?(value) ⇒ Boolean
10 11 12 13 14 15 16 17 |
# File 'lib/attrio/default_value/clonable.rb', line 10 def self.handle?(value) case value when *SINGLETON_CLASSES false else true end end |
Instance Method Details
#call ⇒ Object
Evaluates the value via value#clone
23 24 25 |
# File 'lib/attrio/default_value/clonable.rb', line 23 def call(*) @value.clone end |