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

- (Window) initialize



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

def initialize
  @orders = []
end

Instance Attribute Details

- (Object) framing

Returns the value of attribute framing



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

def framing
  @framing
end

- (Object) orders

Returns the value of attribute orders



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

def orders
  @orders
end

Instance Method Details

- (Boolean) eql?(other) 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

- (Object) frame(expr)



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

def frame(expr)
  @framing = expr
end

- (Object) hash



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

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

- (Object) initialize_copy(other)



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

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

- (Object) order(*expr)



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

- (Object) range(expr = nil)



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

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

- (Object) rows(expr = nil)



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

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