Class: Arel::Nodes::Window
- Defined in:
- activerecord/lib/arel/nodes/window.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#framing ⇒ Object
Returns the value of attribute framing.
-
#orders ⇒ Object
Returns the value of attribute orders.
-
#partitions ⇒ Object
Returns the value of attribute partitions.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
- #frame(expr) ⇒ Object
- #hash ⇒ Object
-
#initialize ⇒ Window
constructor
A new instance of Window.
- #initialize_copy(other) ⇒ Object
- #order(*expr) ⇒ Object
- #partition(*expr) ⇒ Object
- #range(expr = nil) ⇒ Object
- #rows(expr = nil) ⇒ Object
Methods inherited from Node
#and, #equality?, #fetch_attribute, #invert, #not, #or, #to_sql
Methods included from FactoryMethods
#coalesce, #create_and, #create_false, #create_join, #create_on, #create_string_join, #create_table_alias, #create_true, #grouping, #lower
Constructor Details
#initialize ⇒ Window
Returns a new instance of Window.
8 9 10 11 12 |
# File 'activerecord/lib/arel/nodes/window.rb', line 8 def initialize @orders = [] @partitions = [] @framing = nil end |
Instance Attribute Details
#framing ⇒ Object
Returns the value of attribute framing
6 7 8 |
# File 'activerecord/lib/arel/nodes/window.rb', line 6 def framing @framing end |
#orders ⇒ Object
Returns the value of attribute orders
6 7 8 |
# File 'activerecord/lib/arel/nodes/window.rb', line 6 def orders @orders end |
#partitions ⇒ Object
Returns the value of attribute partitions
6 7 8 |
# File 'activerecord/lib/arel/nodes/window.rb', line 6 def partitions @partitions end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
59 60 61 62 63 64 |
# File 'activerecord/lib/arel/nodes/window.rb', line 59 def eql?(other) self.class == other.class && self.orders == other.orders && self.framing == other.framing && self.partitions == other.partitions end |
#frame(expr) ⇒ Object
30 31 32 |
# File 'activerecord/lib/arel/nodes/window.rb', line 30 def frame(expr) @framing = expr end |
#hash ⇒ Object
55 56 57 |
# File 'activerecord/lib/arel/nodes/window.rb', line 55 def hash [@orders, @framing].hash end |
#initialize_copy(other) ⇒ Object
50 51 52 53 |
# File 'activerecord/lib/arel/nodes/window.rb', line 50 def initialize_copy(other) super @orders = @orders.map { |x| x.clone } end |
#order(*expr) ⇒ Object
14 15 16 17 18 19 20 |
# File 'activerecord/lib/arel/nodes/window.rb', line 14 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) ⇒ Object
22 23 24 25 26 27 28 |
# File 'activerecord/lib/arel/nodes/window.rb', line 22 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 |