Class: Squeel::Nodes::Binary
- Includes:
- PredicateOperators
- Defined in:
- lib/squeel/nodes/binary.rb
Overview
A node that represents an operation with two operands.
Instance Attribute Summary collapse
-
#left ⇒ Object
readonly
The left operand.
-
#right ⇒ Object
readonly
The right operand.
Instance Method Summary collapse
-
#eql?(other) ⇒ Boolean
Comparison with other nodes.
- #hash ⇒ Object
-
#initialize(left, right) ⇒ Binary
constructor
A new instance of Binary.
Methods included from PredicateOperators
Constructor Details
#initialize(left, right) ⇒ Binary
Returns a new instance of Binary.
16 17 18 |
# File 'lib/squeel/nodes/binary.rb', line 16 def initialize(left, right) @left, @right = left, right end |
Instance Attribute Details
#left ⇒ Object (readonly)
The left operand
9 10 11 |
# File 'lib/squeel/nodes/binary.rb', line 9 def left @left end |
#right ⇒ Object (readonly)
The right operand
12 13 14 |
# File 'lib/squeel/nodes/binary.rb', line 12 def right @right end |
Instance Method Details
#eql?(other) ⇒ Boolean
Comparison with other nodes
25 26 27 28 29 |
# File 'lib/squeel/nodes/binary.rb', line 25 def eql?(other) self.class.eql?(other.class) && self.left.eql?(other.left) && self.right.eql?(other.right) end |
#hash ⇒ Object
20 21 22 |
# File 'lib/squeel/nodes/binary.rb', line 20 def hash [@left, @right].hash end |