Module: Squeel::Nodes::Operators

Included in:
Function, KeyPath, Stub
Defined in:
lib/squeel/nodes/operators.rb

Overview

Module containing Operation factory methods for inclusion in Squeel nodes

Instance Method Summary collapse

Instance Method Details

#*(value) ⇒ Operation

Factory for a new multiplication operation with this node as its left operand.

Parameters:

  • value

    The right operand

Returns:

  • (Operation)

    The new multiplication operation



23
24
25
# File 'lib/squeel/nodes/operators.rb', line 23

def *(value)
  Operation.new(self, :*, value)
end

#+(value) ⇒ Operation

Factory for a new addition operation with this node as its left operand.

Parameters:

  • value

    The right operand

Returns:



9
10
11
# File 'lib/squeel/nodes/operators.rb', line 9

def +(value)
  Operation.new(self, :+, value)
end

#-(value) ⇒ Operation

Factory for a new subtraction operation with this node as its left operand.

Parameters:

  • value

    The right operand

Returns:

  • (Operation)

    The new subtraction operation



16
17
18
# File 'lib/squeel/nodes/operators.rb', line 16

def -(value)
  Operation.new(self, :-, value)
end

#/(value) ⇒ Operation

Factory for a new division operation with this node as its left operand.

Parameters:

  • value

    The right operand

Returns:



30
31
32
# File 'lib/squeel/nodes/operators.rb', line 30

def /(value)
  Operation.new(self, :/, value)
end

#op(operator, value) ⇒ Operation

Factory for a new custom operation with this node as its left operand.

Parameters:

  • value

    The right operand

Returns:



37
38
39
# File 'lib/squeel/nodes/operators.rb', line 37

def op(operator, value)
  Operation.new(self, operator, value)
end