class Arel::Nodes::Window

Attributes

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

Public Instance Methods

==(other) click to toggle source
Alias for: eql?
eql?(other) click to toggle source
# File lib/arel/nodes/window.rb, line 58
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 29
def frame(expr)
  @framing = expr
end
hash() click to toggle source
# File lib/arel/nodes/window.rb, line 54
def hash
  [@orders, @framing].hash
end
initialize_copy(other) click to toggle source
# File lib/arel/nodes/window.rb, line 49
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 13
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 21
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 41
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 33
def rows(expr = nil)
  if @framing
    Rows.new(expr)
  else
    frame(Rows.new(expr))
  end
end

Public Class Methods

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