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
36 37 38 |
# File 'lib/virtus/attribute/default_value.rb', line 36 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
27 28 29 |
# File 'lib/virtus/attribute/default_value.rb', line 27 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
17 18 19 20 |
# File 'lib/virtus/attribute/default_value.rb', line 17 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
45 46 47 |
# File 'lib/virtus/attribute/default_value.rb', line 45 def call(*) value end |