Class: Veneer::Conditional::Condition

Inherits:
Object
  • Object
show all
Defined in:
lib/veneer/base/conditional.rb

Constant Summary collapse

VALID_OPERATORS =
[:eql, :gt, :gte, :lt, :lte, :in, :not]

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#fieldObject

Returns the value of attribute field.



67
68
69
# File 'lib/veneer/base/conditional.rb', line 67

def field
  @field
end

#operatorObject

Returns the value of attribute operator.



67
68
69
# File 'lib/veneer/base/conditional.rb', line 67

def operator
  @operator
end

#valueObject

Returns the value of attribute value.



67
68
69
# File 'lib/veneer/base/conditional.rb', line 67

def value
  @value
end