Class: Substance::Objects::Defaults::Value
- Inherits:
-
Object
- Object
- Substance::Objects::Defaults::Value
- Includes:
- Tablesalt::Isolation
- Defined in:
- lib/substance/objects/defaults.rb
Instance Method Summary collapse
-
#initialize(static: nil, &block) ⇒ Value
constructor
A new instance of Value.
- #value ⇒ Object
Constructor Details
#initialize(static: nil, &block) ⇒ Value
Returns a new instance of Value.
32 33 34 |
# File 'lib/substance/objects/defaults.rb', line 32 def initialize(static: nil, &block) @value = (static.nil? && block_given?) ? block : static end |
Instance Method Details
#value ⇒ Object
36 37 38 |
# File 'lib/substance/objects/defaults.rb', line 36 def value isolate(@value.respond_to?(:call) ? instance_eval(&@value) : @value) end |