Module: Knuckles::Stages::Combiner
Overview
The combiner stage merges all of the individually rendered results into a single hash. The output of this stage is a single object with string keys and array values, ready to be serialized.
Instance Method Summary collapse
-
#call(prepared, _options) ⇒ Object
Merge all of the rendered data into a single hash.
Instance Method Details
#call(prepared, _options) ⇒ Object
Merge all of the rendered data into a single hash. Each resulting value will be an array, even if there was only one value in the original rendered results.
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/knuckles/stages/combiner.rb', line 45 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 |