class Arel::Nodes::Window

Attributes

framing[RW]
orders[RW]
partitions[RW]

Public Class Methods

new() click to toggle source
# File lib/arel/nodes/window.rb, line 6
def initialize
  @orders = []
  @partitions = []
  @framing = nil
end

Public Instance Methods

==(other)
Alias for: eql?
eql?(other) click to toggle source
# File lib/arel/nodes/window.rb, line 57
def eql? other
  self.class == other.class &&
    self.orders == other.orders &&
    self.framing == other.framing &&
    self.partitions == other.partitions
end
Also aliased as: ==
frame(expr) click to toggle source
# File lib/arel/nodes/window.rb, line 28
def frame(expr)
  @framing = expr
end
hash() click to toggle source
# File lib/arel/nodes/window.rb, line 53
def hash
  [@orders, @framing].hash
end
initialize_copy(other) click to toggle source
Calls superclass method
# File lib/arel/nodes/window.rb, line 48
def initialize_copy other
  super
  @orders = @orders.map { |x| x.clone }
end
order(*expr) click to toggle source
# File lib/arel/nodes/window.rb, line 12
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) click to toggle source
# File lib/arel/nodes/window.rb, line 20
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) click to toggle source
# File lib/arel/nodes/window.rb, line 40
def range(expr = nil)
  if @framing
    Range.new(expr)
  else
    frame(Range.new(expr))
  end
end
rows(expr = nil) click to toggle source
# File lib/arel/nodes/window.rb, line 32
def rows(expr = nil)
  if @framing
    Rows.new(expr)
  else
    frame(Rows.new(expr))
  end
end