Class: Arel::Nodes::Window

Inherits:
Node
  • Object
show all
Defined in:
lib/arel/nodes/window.rb

Direct Known Subclasses

NamedWindow

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#_caller, #and, #each, #not, #or, #to_sql

Methods included from FactoryMethods

#create_and, #create_false, #create_join, #create_on, #create_string_join, #create_table_alias, #create_true, #grouping, #lower

Constructor Details

#initializeWindow



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

def initialize
  @orders = []
end

Instance Attribute Details

#framingObject

Returns the value of attribute framing



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

def framing
  @framing
end

#ordersObject

Returns the value of attribute orders



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

def orders
  @orders
end

Instance Method Details

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



39
40
41
42
43
# File 'lib/arel/nodes/window.rb', line 39

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

#frame(expr) ⇒ Object



18
19
20
# File 'lib/arel/nodes/window.rb', line 18

def frame(expr)
  @framing = expr
end

#hashObject



35
36
37
# File 'lib/arel/nodes/window.rb', line 35

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

#initialize_copy(other) ⇒ Object



30
31
32
33
# File 'lib/arel/nodes/window.rb', line 30

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

#order(*expr) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/arel/nodes/window.rb', line 10

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

#range(expr = nil) ⇒ Object



26
27
28
# File 'lib/arel/nodes/window.rb', line 26

def range(expr = nil)
  frame(Range.new(expr))
end

#rows(expr = nil) ⇒ Object



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

def rows(expr = nil)
  frame(Rows.new(expr))
end