Class: ActiveRecordExtended::QueryMethods::Unionize::UnionChain
- Inherits:
-
Object
- Object
- ActiveRecordExtended::QueryMethods::Unionize::UnionChain
show all
- Includes:
- Utilities
- Defined in:
- lib/active_record_extended/query_methods/unionize.rb
Constant Summary
Constants included
from Utilities
Utilities::A_TO_Z_KEYS
Instance Method Summary
collapse
Methods included from Utilities
#double_quote, #flatten_safely, #flatten_to_sql, #from_clause_constructor, #key_generator, #literal_key, #nested_alias_escape, #pipe_cte_with!, #to_arel_sql, #wrap_with_array
Constructor Details
#initialize(scope) ⇒ UnionChain
Returns a new instance of UnionChain.
12
13
14
|
# File 'lib/active_record_extended/query_methods/unionize.rb', line 12
def initialize(scope)
@scope = scope
end
|
Instance Method Details
#all(*args) ⇒ Object
Also known as:
union_all
40
41
42
43
|
# File 'lib/active_record_extended/query_methods/unionize.rb', line 40
def all(*args)
append_union_order!(:union_all, args)
@scope
end
|
#as(from_clause_name) ⇒ Object
Also known as:
union_as
16
17
18
19
|
# File 'lib/active_record_extended/query_methods/unionize.rb', line 16
def as(from_clause_name)
@scope.unionized_name = from_clause_name.to_s
@scope
end
|
#except(*args) ⇒ Object
Also known as:
union_except
46
47
48
49
|
# File 'lib/active_record_extended/query_methods/unionize.rb', line 46
def except(*args)
append_union_order!(:except, args)
@scope
end
|
#intersect(*args) ⇒ Object
Also known as:
union_intersect
52
53
54
55
|
# File 'lib/active_record_extended/query_methods/unionize.rb', line 52
def intersect(*args)
append_union_order!(:intersect, args)
@scope
end
|
#order(*ordering_args) ⇒ Object
Also known as:
order_union
22
23
24
25
26
|
# File 'lib/active_record_extended/query_methods/unionize.rb', line 22
def order(*ordering_args)
process_ordering_arguments!(ordering_args)
@scope.union_ordering_values += ordering_args
@scope
end
|
#reorder(*ordering_args) ⇒ Object
Also known as:
reorder_union
29
30
31
32
|
# File 'lib/active_record_extended/query_methods/unionize.rb', line 29
def reorder(*ordering_args)
@scope.union_ordering_values.clear
order(*ordering_args)
end
|
#union(*args) ⇒ Object
35
36
37
38
|
# File 'lib/active_record_extended/query_methods/unionize.rb', line 35
def union(*args)
append_union_order!(:union, args)
@scope
end
|