Class: Arity2Operators
- Defined in:
- lib/lamep/Expressions/arity2_operators.rb
Direct Known Subclasses
And, Equal, GreaterThan, GreaterThanEqual, LessThan, LessThanEqual, NotEqual, Or
Constant Summary collapse
- ARITY =
2
Constants inherited from Operator
Instance Attribute Summary collapse
-
#left ⇒ Object
readonly
Returns the value of attribute left.
-
#right ⇒ Object
readonly
Returns the value of attribute right.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #equal?)
-
#initialize(left, right) ⇒ Arity2Operators
constructor
A new instance of Arity2Operators.
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
#left ⇒ Object (readonly)
Returns the value of attribute left.
3 4 5 |
# File 'lib/lamep/Expressions/arity2_operators.rb', line 3 def left @left end |
#right ⇒ Object (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 |