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
Returns a new instance of Value.
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/uber/options.rb', line 45 def initialize(value, ={}) @value, @dynamic = value, [:dynamic] @proc = proc? @callable = callable? @method = method? return if .has_key?(:dynamic) @dynamic = @proc || @callable || @method end |
Instance Method Details
#dynamic? ⇒ Boolean
63 64 65 |
# File 'lib/uber/options.rb', line 63 def dynamic? @dynamic end |
#evaluate(context, *args) ⇒ Object
57 58 59 60 61 |
# File 'lib/uber/options.rb', line 57 def evaluate(context, *args) return @value unless dynamic? evaluate_for(context, *args) end |