Class: Arel::Nodes::AggregateFunctionName

Inherits:
Node
  • Object
show all
Includes:
Predications, WindowPredications
Defined in:
lib/active_record_extended/arel/aggregate_function_name.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Predications

#all, #any, #contained_in_array, #contains, #inet_contained_within, #inet_contained_within_or_equals, #inet_contains, #inet_contains_or_equals, #inet_contains_or_is_contained_within, #overlaps

Constructor Details

#initialize(name, expr, distinct = false) ⇒ AggregateFunctionName

Returns a new instance of AggregateFunctionName.



10
11
12
13
14
15
# File 'lib/active_record_extended/arel/aggregate_function_name.rb', line 10

def initialize(name, expr, distinct = false)
  super()
  @name        = name.to_s.upcase
  @expressions = expr
  @distinct    = distinct
end

Instance Attribute Details

#aliasObject

Returns the value of attribute alias.



8
9
10
# File 'lib/active_record_extended/arel/aggregate_function_name.rb', line 8

def alias
  @alias
end

#distinctObject

Returns the value of attribute distinct.



8
9
10
# File 'lib/active_record_extended/arel/aggregate_function_name.rb', line 8

def distinct
  @distinct
end

#expressionsObject

Returns the value of attribute expressions.



8
9
10
# File 'lib/active_record_extended/arel/aggregate_function_name.rb', line 8

def expressions
  @expressions
end

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/active_record_extended/arel/aggregate_function_name.rb', line 8

def name
  @name
end

#orderingsObject

Returns the value of attribute orderings.



8
9
10
# File 'lib/active_record_extended/arel/aggregate_function_name.rb', line 8

def orderings
  @orderings
end

Instance Method Details

#as(aliaz) ⇒ Object



22
23
24
25
# File 'lib/active_record_extended/arel/aggregate_function_name.rb', line 22

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

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

Returns:

  • (Boolean)


31
32
33
34
35
36
# File 'lib/active_record_extended/arel/aggregate_function_name.rb', line 31

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

#hashObject



27
28
29
# File 'lib/active_record_extended/arel/aggregate_function_name.rb', line 27

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

#order_by(expr) ⇒ Object



17
18
19
20
# File 'lib/active_record_extended/arel/aggregate_function_name.rb', line 17

def order_by(expr)
  @orderings = expr
  self
end