Class: Uber::Options::Value
- Inherits:
-
Object
- Object
- Uber::Options::Value
- Defined in:
- lib/uber/options.rb
Overview
DEPRECATED! PLEASE USE UBER::OPTION.
Instance Method Summary collapse
- #call(context, *args) ⇒ Object (also: #evaluate)
- #callable? ⇒ Boolean
- #dynamic? ⇒ Boolean
-
#initialize(value, options = {}) ⇒ Value
constructor
TODO: rename to Value.
- #method? ⇒ Boolean
- #proc? ⇒ Boolean
Constructor Details
#initialize(value, options = {}) ⇒ Value
TODO: rename to Value.
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/uber/options.rb', line 32 def initialize(value, ={}) @value, @dynamic = value, [:dynamic] @proc = proc? @callable = callable? @method = method? return if .has_key?(:dynamic) @dynamic = @proc || @callable || @method end |
Instance Method Details
#call(context, *args) ⇒ Object Also known as: evaluate
44 45 46 47 48 |
# File 'lib/uber/options.rb', line 44 def call(context, *args) return @value unless dynamic? evaluate_for(context, *args) end |
#callable? ⇒ Boolean
59 60 61 |
# File 'lib/uber/options.rb', line 59 def callable? @value.is_a?(Uber::Callable) end |
#dynamic? ⇒ Boolean
51 52 53 |
# File 'lib/uber/options.rb', line 51 def dynamic? @dynamic end |
#method? ⇒ Boolean
63 64 65 |
# File 'lib/uber/options.rb', line 63 def method? @value.is_a?(Symbol) end |
#proc? ⇒ Boolean
55 56 57 |
# File 'lib/uber/options.rb', line 55 def proc? @value.kind_of?(Proc) end |