Class: Uber::Options::Value

Inherits:
Object
  • Object
show all
Defined in:
lib/uber/options.rb

Overview

TODO: rename to Value.

Instance Method Summary collapse

Constructor Details

#initialize(value, options = {}) ⇒ Value

Returns a new instance of Value.



43
44
45
46
# File 'lib/uber/options.rb', line 43

def initialize(value, options={})
  @value = value || true
  @options = options
end

Instance Method Details

#dynamic?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/uber/options.rb', line 54

def dynamic?
  @options[:instance_method] || @value.kind_of?(Proc)
end

#evaluate(context, *args) ⇒ Object



48
49
50
51
52
# File 'lib/uber/options.rb', line 48

def evaluate(context, *args)
  return true if @value.is_a?(TrueClass)

  evaluate_for(context, *args)
end