123456789_123456789_123456789_123456789_123456789_

Class: Arel::Nodes::Function

Do not use. This class is for internal use only.
Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: Arel::Nodes::NodeExpression
Defined in: activerecord/lib/arel/nodes/function.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

::Arel::FilterPredications - Included

::Arel::WindowPredications - Included

::Arel::Math - Included

#&, #*, #+, #-, #/, #<<, #>>, #^, #|, #~@

::Arel::OrderPredications - Included

::Arel::AliasPredication - Included

#as

::Arel::Predications - Included

::Arel::Expressions - Included

Node - Inherited

#and

Factory method to create an And node.

#fetch_attribute, #invert,
#not

Factory method to create a Nodes::Not node that has the recipient of the caller as a child.

#or

Factory method to create a Grouping node that has an Or node as a child.

#to_sql

FIXME: this method should go away.

::Arel::FactoryMethods - Included

Constructor Details

.new(expr, aliaz = nil) ⇒ Function

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/function.rb', line 10

def initialize(expr, aliaz = nil)
  super()
  @expressions = expr
  @alias       = aliaz && SqlLiteral.new(aliaz)
  @distinct    = false
end

Instance Attribute Details

#alias (rw)

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/function.rb', line 8

attr_accessor :expressions, :alias, :distinct

#distinct (rw)

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/function.rb', line 8

attr_accessor :expressions, :alias, :distinct

#expressions (rw)

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/function.rb', line 8

attr_accessor :expressions, :alias, :distinct

Instance Method Details

#==(other)

Alias for #eql?.

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/function.rb', line 32

alias :== :eql?

#as(aliaz)

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/function.rb', line 17

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

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

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/function.rb', line 26

def eql?(other)
  self.class == other.class &&
    self.expressions == other.expressions &&
    self.alias == other.alias &&
    self.distinct == other.distinct
end

#hash

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/function.rb', line 22

def hash
  [@expressions, @alias, @distinct].hash
end