Class: Arel::Nodes::Window
- Inherits:
-
Node
- Object
- Node
- Arel::Nodes::Window
- Includes:
- Expression
- Defined in:
- lib/arel/nodes/window.rb
Direct Known Subclasses
Instance Attribute Summary (collapse)
-
- (Object) framing
Returns the value of attribute framing.
-
- (Object) orders
Returns the value of attribute orders.
Instance Method Summary (collapse)
- - (Object) frame(expr)
-
- (Window) initialize
constructor
A new instance of Window.
- - (Object) initialize_copy(other)
- - (Object) order(*expr)
- - (Object) range(expr = nil)
- - (Object) rows(expr = nil)
Methods included from OrderPredications
Methods inherited from Node
#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
A new instance of Window
7 8 9 |
# File 'lib/arel/nodes/window.rb', line 7 def initialize @orders = [] end |
Instance Attribute Details
- (Object) framing
Returns the value of attribute framing
5 6 7 |
# File 'lib/arel/nodes/window.rb', line 5 def framing @framing end |
- (Object) orders
Returns the value of attribute orders
5 6 7 |
# File 'lib/arel/nodes/window.rb', line 5 def orders @orders end |
Instance Method Details
- (Object) frame(expr)
19 20 21 22 |
# File 'lib/arel/nodes/window.rb', line 19 def frame(expr) raise ArgumentError, "Window frame cannot be set more than once" if @frame @framing = expr end |
- (Object) initialize_copy(other)
32 33 34 35 |
# File 'lib/arel/nodes/window.rb', line 32 def initialize_copy other super @orders = @orders.map { |x| x.clone } end |
- (Object) order(*expr)
11 12 13 14 15 16 17 |
# File 'lib/arel/nodes/window.rb', line 11 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)
28 29 30 |
# File 'lib/arel/nodes/window.rb', line 28 def range(expr = nil) frame(Range.new(expr)) end |
- (Object) rows(expr = nil)
24 25 26 |
# File 'lib/arel/nodes/window.rb', line 24 def rows(expr = nil) frame(Rows.new(expr)) end |