Class: Uber::Options::Value
- Inherits:
-
Object
- Object
- Uber::Options::Value
- Defined in:
- lib/uber/options.rb
Overview
TODO: rename to Value.
Instance Method Summary collapse
- #dynamic? ⇒ Boolean
- #evaluate(context, *args) ⇒ Object
-
#initialize(value, options = {}) ⇒ Value
constructor
A new instance of Value.
Constructor Details
#initialize(value, options = {}) ⇒ Value
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/uber/options.rb', line 43 def initialize(value, ={}) @value, @dynamic = value, [:dynamic] @callable = true if @value.kind_of?(Proc) return if .has_key?(:dynamic) # conventional behaviour: @dynamic = true if @callable @dynamic = true if @value.is_a?(Symbol) end |
Instance Method Details
#dynamic? ⇒ Boolean
61 62 63 |
# File 'lib/uber/options.rb', line 61 def dynamic? @dynamic end |
#evaluate(context, *args) ⇒ Object
55 56 57 58 59 |
# File 'lib/uber/options.rb', line 55 def evaluate(context, *args) return @value unless dynamic? evaluate_for(context, *args) end |