Class: Squeel::Nodes::Operation

Inherits:
Function show all
Defined in:
lib/squeel/nodes/operation.rb

Overview

An Operation is basically a function with its operands limited, and rearranged, so Squeel implements it as such.

Instance Attribute Summary

Attributes inherited from Function

#args, #function_name

Instance Method Summary collapse

Methods inherited from Function

#eql?, #hash, #to_sym

Methods included from Aliasing

#as

Methods included from Ordering

#asc, #desc

Methods included from Operators

#*, #+, #-, #/, #op

Methods included from PredicateOperators

#&, #-@, #|

Methods included from PredicateMethods

#eq

Methods inherited from Node

#each, #grep

Constructor Details

#initialize(left, operator, right) ⇒ Operation

Create a new Operation with the given operator and left and right operands

Parameters:

  • left

    The left operand

  • operator (String, Symbol)

    The operator

  • right

    The right operand



13
14
15
# File 'lib/squeel/nodes/operation.rb', line 13

def initialize(left, operator, right)
  super(operator, [left, right])
end

Instance Method Details

#leftObject

Returns The left operand.

Returns:

  • The left operand



21
22
23
# File 'lib/squeel/nodes/operation.rb', line 21

def left
  args[0]
end

#rightObject

Returns The right operand.

Returns:

  • The right operand



26
27
28
# File 'lib/squeel/nodes/operation.rb', line 26

def right
  args[1]
end