Class: Query::Combiner

Inherits:
Object show all
Defined in:
lib/query/combiner.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*sources) ⇒ Combiner



5
6
7
# File 'lib/query/combiner.rb', line 5

def initialize(*sources)
  self.sources = sources
end

Class Method Details

.combineObject



9
10
11
# File 'lib/query/combiner.rb', line 9

def self.combine(...)
  new(...).combine
end

Instance Method Details

#combineObject



13
14
15
16
17
18
19
20
21
# File 'lib/query/combiner.rb', line 13

def combine
  sources.map do |source|
    Query.evaluate(source)
  end.reduce do |acc, element|
    combine_parsed(acc, element)
  end.then do |parsed|
    Query.decompile(parsed)
  end
end