Class: Arel::Nodes::Function

Inherits:
Node
  • Object
show all
Includes:
Expression
Defined in:
lib/arel/nodes/function.rb

Direct Known Subclasses

Avg, Count, Exists, Max, Min, Sum

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#and, #each, #not, #or, #to_sql

Constructor Details

#initialize(expr, aliaz = nil) ⇒ Function

Returns a new instance of Function.



7
8
9
10
# File 'lib/arel/nodes/function.rb', line 7

def initialize expr, aliaz = nil
  @expressions = expr
  @alias       = aliaz
end

Instance Attribute Details

#aliasObject

Returns the value of attribute alias.



5
6
7
# File 'lib/arel/nodes/function.rb', line 5

def alias
  @alias
end

#expressionsObject

Returns the value of attribute expressions.



5
6
7
# File 'lib/arel/nodes/function.rb', line 5

def expressions
  @expressions
end

Instance Method Details

#as(aliaz) ⇒ Object



12
13
14
15
# File 'lib/arel/nodes/function.rb', line 12

def as aliaz
  self.alias = SqlLiteral.new(aliaz)
  self
end