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
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].(*args) end |
#evaluate(context, *args) ⇒ Object
Evaluates every element and returns a hash. Accepts context and arbitrary arguments.
15 16 17 18 19 20 21 |
# File 'lib/uber/options.rb', line 15 def evaluate(context, *args) {}.tap do |evaluated| each do |k,v| evaluated[k] = v.(context, *args) end end end |