Class: Squeel::Nodes::Function

Inherits:
Node
  • Object
show all
Includes:
Aliasing, Operators, Ordering, PredicateMethods, PredicateOperators
Defined in:
lib/squeel/nodes/function.rb

Overview

A node that represents an SQL function call

Direct Known Subclasses

Operation

Instance Attribute Summary collapse

Instance Method Summary collapse

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(function_name, args) ⇒ Function

Create a node representing an SQL Function with the given name and arguments



33
34
35
# File 'lib/squeel/nodes/function.rb', line 33

def initialize(function_name, args)
  @function_name, @args = function_name, args
end

Instance Attribute Details

#argsArray (readonly)



28
29
30
# File 'lib/squeel/nodes/function.rb', line 28

def args
  @args
end

#function_nameSymbol (readonly)



25
26
27
# File 'lib/squeel/nodes/function.rb', line 25

def function_name
  @function_name
end

Instance Method Details

#eql?(other) ⇒ Boolean



49
50
51
52
53
# File 'lib/squeel/nodes/function.rb', line 49

def eql?(other)
  self.class == other.class &&
    self.function_name.eql?(other.function_name) &&
    self.args.eql?(other.args)
end

#hashObject



45
46
47
# File 'lib/squeel/nodes/function.rb', line 45

def hash
  [@name, @args].hash
end

#to_symNilClass

expand_hash_conditions_for_aggregates assumes our hash keys can be converted to symbols, so this has to be implemented, but it doesn't really have to do anything useful.



41
42
43
# File 'lib/squeel/nodes/function.rb', line 41

def to_sym
  nil
end