Class: Squeel::Nodes::Binary

Inherits:
Object
  • Object
show all
Includes:
PredicateOperators
Defined in:
lib/squeel/nodes/binary.rb

Overview

A node that represents an operation with two operands.

Direct Known Subclasses

As, Or

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from PredicateOperators

#&, #-@, #|

Constructor Details

#initialize(left, right) ⇒ Binary

Returns a new instance of Binary.

Parameters:

  • left

    The left operand

  • right

    The right operand



18
19
20
# File 'lib/squeel/nodes/binary.rb', line 18

def initialize(left, right)
  @left, @right = left, right
end

Instance Attribute Details

#leftObject (readonly)

The left operand



11
12
13
# File 'lib/squeel/nodes/binary.rb', line 11

def left
  @left
end

#rightObject (readonly)

The right operand



14
15
16
# File 'lib/squeel/nodes/binary.rb', line 14

def right
  @right
end

Instance Method Details

#eql?(other) ⇒ Boolean Also known as: ==

Comparison with other nodes

Returns:

  • (Boolean)


23
24
25
26
27
# File 'lib/squeel/nodes/binary.rb', line 23

def eql?(other)
  self.class.eql?(other.class) &&
  self.left.eql?(other.left) &&
  self.right.eql?(other.right)
end