Class: Virtus::Attribute::DefaultValue Private
- Inherits:
-
Object
- Object
- Virtus::Attribute::DefaultValue
- Extended by:
- DescendantsTracker
- Defined in:
- lib/virtus/attribute/default_value.rb,
lib/virtus/attribute/default_value/from_symbol.rb,
lib/virtus/attribute/default_value/from_callable.rb,
lib/virtus/attribute/default_value/from_clonable.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Class representing the default value option
Direct Known Subclasses
Defined Under Namespace
Classes: FromCallable, FromClonable, FromSymbol
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
private
Returns the value instance.
Class Method Summary collapse
-
.build(*args) ⇒ Virtus::Attribute::DefaultValue
private
Builds a default value instance.
Instance Method Summary collapse
-
#call ⇒ Object
private
Evaluates the value.
-
#initialize(value) ⇒ undefined
constructor
private
Initializes an default value instance.
Constructor Details
#initialize(value) ⇒ undefined
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes an default value instance
34 35 36 |
# File 'lib/virtus/attribute/default_value.rb', line 34 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the value instance
25 26 27 |
# File 'lib/virtus/attribute/default_value.rb', line 25 def value @value end |
Class Method Details
.build(*args) ⇒ Virtus::Attribute::DefaultValue
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Builds a default value instance
15 16 17 18 |
# File 'lib/virtus/attribute/default_value.rb', line 15 def self.build(*args) klass = descendants.detect { |descendant| descendant.handle?(*args) } || self klass.new(*args) end |
Instance Method Details
#call ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Evaluates the value
43 44 45 |
# File 'lib/virtus/attribute/default_value.rb', line 43 def call(*) value end |