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.
43 44 45 46 47 48 49 50 51 |
# File 'lib/uber/options.rb', line 43 def initialize(value, ={}) @value, @options = value, return if @options.has_key?(:dynamic) # conventional behaviour: @callable = @options[:dynamic] = true if @value.kind_of?(Proc) @options[:dynamic] = true if @value.is_a?(Symbol) end |
Instance Method Details
#dynamic? ⇒ Boolean
59 60 61 |
# File 'lib/uber/options.rb', line 59 def dynamic? @options[:dynamic] end |
#evaluate(context, *args) ⇒ Object
53 54 55 56 57 |
# File 'lib/uber/options.rb', line 53 def evaluate(context, *args) return @value unless dynamic? evaluate_for(context, *args) end |