Class: ActiveRecordExtended::QueryMethods::Window::DefineWindowChain
- Inherits:
-
Object
- Object
- ActiveRecordExtended::QueryMethods::Window::DefineWindowChain
- Includes:
- Utilities::OrderBy, Utilities::Support
- Defined in:
- lib/active_record_extended/query_methods/window.rb
Constant Summary
Constants included from Utilities::Support
Utilities::Support::A_TO_Z_KEYS
Instance Method Summary collapse
-
#initialize(scope, window_name) ⇒ DefineWindowChain
constructor
A new instance of DefineWindowChain.
- #partition_by(*partitions, order_by: nil) ⇒ Object
Methods included from Utilities::OrderBy
#inline_order_by, #order_by_expression, #process_ordering_arguments!, #scope_preprocess_order_args, #to_ordered_table_path
Methods included from Utilities::Support
#double_quote, #flatten_safely, #flatten_to_sql, #from_clause_constructor, #generate_grouping, #generate_named_function, #group_when_needed, #key_generator, #literal_key, #needs_to_be_grouped?, #nested_alias_escape, #pipe_cte_with!, #to_arel_sql, #wrap_with_agg_array, #wrap_with_array
Constructor Details
#initialize(scope, window_name) ⇒ DefineWindowChain
Returns a new instance of DefineWindowChain.
10 11 12 13 |
# File 'lib/active_record_extended/query_methods/window.rb', line 10 def initialize(scope, window_name) @scope = scope @window_name = window_name end |
Instance Method Details
#partition_by(*partitions, order_by: nil) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/active_record_extended/query_methods/window.rb', line 15 def partition_by(*partitions, order_by: nil) @scope.window_values! << { window_name: to_arel_sql(@window_name), partition_by: flatten_to_sql(partitions), order_by: order_by_expression(order_by) } @scope end |