123456789_123456789_123456789_123456789_123456789_

Class: Arel::Nodes::Window

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:
self, Node
Instance Chain:
Inherits: Arel::Nodes::Node
Defined in: activerecord/lib/arel/nodes/window.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

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

.newWindow

[ GitHub ]

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

def initialize
  @orders = []
  @partitions = []
  @framing = nil
end

Instance Attribute Details

#framing (rw)

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/window.rb', line 6

attr_accessor :orders, :framing, :partitions

#orders (rw)

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/window.rb', line 6

attr_accessor :orders, :framing, :partitions

#partitions (rw)

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/window.rb', line 6

attr_accessor :orders, :framing, :partitions

Instance Method Details

#==(other)

Alias for #eql?.

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/window.rb', line 65

alias :== :eql?

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

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/window.rb', line 59

def eql?(other)
  self.class == other.class &&
    self.orders == other.orders &&
    self.framing == other.framing &&
    self.partitions == other.partitions
end

#frame(expr)

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/window.rb', line 30

def frame(expr)
  @framing = expr
end

#hash

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/window.rb', line 55

def hash
  [@orders, @framing].hash
end

#initialize_copy(other)

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/window.rb', line 50

def initialize_copy(other)
  super
  @orders = @orders.map { |x| x.clone }
end

#order(*expr)

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/window.rb', line 14

def order(*expr)
  # FIXME: We SHOULD NOT be converting these to SqlLiteral automatically
  @orders.concat expr.map { |x|
    String === x || Symbol === x ? Nodes::SqlLiteral.new(x.to_s) : x
  }
  self
end

#partition(*expr)

[ GitHub ]

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

def partition(*expr)
  # FIXME: We SHOULD NOT be converting these to SqlLiteral automatically
  @partitions.concat expr.map { |x|
    String === x || Symbol === x ? Nodes::SqlLiteral.new(x.to_s) : x
  }
  self
end

#range(expr = nil)

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/window.rb', line 42

def range(expr = nil)
  if @framing
    Range.new(expr)
  else
    frame(Range.new(expr))
  end
end

#rows(expr = nil)

[ GitHub ]

  
# File 'activerecord/lib/arel/nodes/window.rb', line 34

def rows(expr = nil)
  if @framing
    Rows.new(expr)
  else
    frame(Rows.new(expr))
  end
end