Module: Knuckles::Stages::Combiner
Instance Method Summary collapse
Instance Method Details
#array_backed_hash ⇒ Object
19 20 21 |
# File 'lib/knuckles/stages/combiner.rb', line 19 def array_backed_hash Hash.new { |hash, key| hash[key] = [] } end |
#call(prepared, _) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/knuckles/stages/combiner.rb', line 8 def call(prepared, _) prepared.each_with_object(array_backed_hash) do |hash, memo| hash[:result].each do |root, values| case values when Hash then memo[root.to_s] << values when Array then memo[root.to_s] += values end end end end |