Class: BB::Evaluator::Value
- Inherits:
-
Object
- Object
- BB::Evaluator::Value
- Defined in:
- lib/b_b/evaluator/value.rb
Constant Summary collapse
- EVALUATE_TYPES =
%i(array boolean date null numeric range regexp string subquery time).freeze
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #eval_type ⇒ Object
-
#initialize(value, options = {}) ⇒ Value
constructor
A new instance of Value.
Constructor Details
#initialize(value, options = {}) ⇒ Value
Returns a new instance of Value.
8 9 10 11 |
# File 'lib/b_b/evaluator/value.rb', line 8 def initialize(value, = {}) @value = value @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/b_b/evaluator/value.rb', line 6 def @options end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/b_b/evaluator/value.rb', line 6 def value @value end |
Class Method Details
.eval_type(value, options = {}) ⇒ Object
66 67 68 |
# File 'lib/b_b/evaluator/value.rb', line 66 def eval_type(value, = {}) new(value, ).eval_type end |
Instance Method Details
#eval_type ⇒ Object
13 14 15 16 17 |
# File 'lib/b_b/evaluator/value.rb', line 13 def eval_type eval_types.detect { |type| send("#{type}?") }.tap do |type| raise UnevaluableTypeError, "unevaluable type of value: #{value} (#{value.class})" if type.nil? end end |