Class: Uber::Options
- Inherits:
-
Hash
- Object
- Hash
- Uber::Options
- Defined in:
- lib/uber/options.rb
Defined Under Namespace
Classes: Value
Instance Method Summary collapse
-
#eval(key, *args) ⇒ Object
Evaluates a single value.
-
#evaluate(context, *args) ⇒ Object
Evaluates every element and returns a hash.
-
#initialize(options) ⇒ Options
constructor
A new instance of Options.
Constructor Details
#initialize(options) ⇒ Options
Returns a new instance of Options.
3 4 5 6 7 8 9 10 |
# File 'lib/uber/options.rb', line 3 def initialize() @static = .each do |k,v| self[k] = option = Value.new(v) @static = nil if option.dynamic? end end |
Instance Method Details
#eval(key, *args) ⇒ Object
Evaluates a single value.
24 25 26 |
# File 'lib/uber/options.rb', line 24 def eval(key, *args) self[key].evaluate(*args) end |
#evaluate(context, *args) ⇒ Object
Evaluates every element and returns a hash. Accepts context and arbitrary arguments.
17 18 19 20 21 |
# File 'lib/uber/options.rb', line 17 def evaluate(context, *args) return @static unless dynamic? evaluate_for(context, *args) end |