Class: Veneer::Conditional::Condition
- Inherits:
-
Object
- Object
- Veneer::Conditional::Condition
- Defined in:
- lib/veneer/base/conditional.rb
Constant Summary collapse
- VALID_OPERATORS =
[:eql, :gt, :gte, :lt, :lte, :in, :not]
Instance Attribute Summary collapse
-
#field ⇒ Object
Returns the value of attribute field.
-
#operator ⇒ Object
Returns the value of attribute operator.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(field, value, operator = :eql) ⇒ Condition
constructor
A new instance of Condition.
Constructor Details
#initialize(field, value, operator = :eql) ⇒ Condition
Returns a new instance of Condition.
71 72 73 74 |
# File 'lib/veneer/base/conditional.rb', line 71 def initialize(field, value, operator = :eql) @field, @value, @operator = field.to_sym, value, operator.to_sym raise Veneer::Errors::ConditionalOperatorNotSupported, "#{operator.inspect} not a valid operator" unless VALID_OPERATORS.include?(operator) end |
Instance Attribute Details
#field ⇒ Object
Returns the value of attribute field.
67 68 69 |
# File 'lib/veneer/base/conditional.rb', line 67 def field @field end |
#operator ⇒ Object
Returns the value of attribute operator.
67 68 69 |
# File 'lib/veneer/base/conditional.rb', line 67 def operator @operator end |
#value ⇒ Object
Returns the value of attribute value.
67 68 69 |
# File 'lib/veneer/base/conditional.rb', line 67 def value @value end |