Class: Quo::QueryComposer

Inherits:
Object
  • Object
show all
Defined in:
lib/quo/query_composer.rb

Instance Method Summary collapse

Constructor Details

#initialize(left, right, joins = nil) ⇒ QueryComposer

Returns a new instance of QueryComposer.



5
6
7
8
9
10
11
12
13
# File 'lib/quo/query_composer.rb', line 5

def initialize(left, right, joins = nil)
  @left = left
  @right = right
  @unwrapped_left = unwrap_relation(left)
  @unwrapped_right = unwrap_relation(right)
  @left_relation = @unwrapped_left.is_a?(::ActiveRecord::Relation)
  @right_relation = @unwrapped_right.is_a?(::ActiveRecord::Relation)
  @joins = joins
end

Instance Method Details

#composeObject



15
16
17
18
19
20
21
22
# File 'lib/quo/query_composer.rb', line 15

def compose
  Quo::MergedQuery.new(
    merge_left_and_right,
    left,
    right,
    **merged_options
  )
end