Class: ActiveRecordExtended::QueryMethods::WithCTE::WithChain
- Inherits:
-
Object
- Object
- ActiveRecordExtended::QueryMethods::WithCTE::WithChain
- Defined in:
- lib/active_record_extended/query_methods/with_cte.rb
Instance Method Summary collapse
-
#initialize(scope) ⇒ WithChain
constructor
A new instance of WithChain.
- #materialized(args) ⇒ Object
- #not_materialized(args) ⇒ Object
- #recursive(args) ⇒ Object
Constructor Details
Instance Method Details
#materialized(args) ⇒ Object
98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/active_record_extended/query_methods/with_cte.rb', line 98 def materialized(args) @scope.tap do |scope| args.each_pair do |name, _expression| sym_name = name.to_sym raise ArgumentError.new("CTE already set as not_materialized") if scope.cte.not_materialized_key?(sym_name) scope.cte.materialized_keys << sym_name end scope.cte.pipe_cte_with!(args) end end |
#not_materialized(args) ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/active_record_extended/query_methods/with_cte.rb', line 111 def not_materialized(args) @scope.tap do |scope| args.each_pair do |name, _expression| sym_name = name.to_sym raise ArgumentError.new("CTE already set as materialized") if scope.cte.materialized_key?(sym_name) scope.cte.not_materialized_keys << sym_name end scope.cte.pipe_cte_with!(args) end end |
#recursive(args) ⇒ Object
90 91 92 93 94 95 |
# File 'lib/active_record_extended/query_methods/with_cte.rb', line 90 def recursive(args) @scope.tap do |scope| scope.recursive_value = true scope.cte.pipe_cte_with!(args) end end |