class Uber::Options
Public Class Methods
new(options)
click to toggle source
# File lib/uber/options.rb, line 6 def initialize(options) @static = options options.each do |k,v| self[k] = Option[v, instance_exec: true] end end
Public Instance Methods
eval(key, *args)
click to toggle source
Evaluates a single value.
# File lib/uber/options.rb, line 24 def eval(key, *args) self[key].(*args) end
evaluate(context, *args)
click to toggle source
Evaluates every element and returns a hash. Accepts context and arbitrary arguments.
# 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