Class: Arity2Operators

Inherits:
Operator show all
Defined in:
lib/lamep/Expressions/arity2_operators.rb

Constant Summary collapse

ARITY =
2

Constants inherited from Operator

Operator::OPERATORS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Operator

exists?, factory!, operator, precedence!, register, #to_sql

Constructor Details

#initialize(left, right) ⇒ Arity2Operators

Returns a new instance of Arity2Operators.



6
7
8
9
# File 'lib/lamep/Expressions/arity2_operators.rb', line 6

def initialize(left, right)
  @left = (left.is_a?(Operator)) ? left : ValueExpression.new(left)
  @right = (right.is_a?(Operator)) ? right : ValueExpression.new(right)
end

Instance Attribute Details

#leftObject (readonly)

Returns the value of attribute left.



3
4
5
# File 'lib/lamep/Expressions/arity2_operators.rb', line 3

def left
  @left
end

#rightObject (readonly)

Returns the value of attribute right.



3
4
5
# File 'lib/lamep/Expressions/arity2_operators.rb', line 3

def right
  @right
end

Instance Method Details

#==(other) ⇒ Object Also known as: equal?



11
12
13
# File 'lib/lamep/Expressions/arity2_operators.rb', line 11

def ==(other)
  other.class == self.class && other.left == @left && other.right == @right
end