class Sprockets::Bundle

def self.process_bundle_reducers(assets, reducers)

Returns reduced asset metadata Hash.

reducers - Array of [initial, reducer_proc] pairs
assets - Array of Assets

metadata Hash.
Internal: Run bundle reducers on set of Assets producing a reduced
def self.process_bundle_reducers(assets, reducers)
  initial = {}
  reducers.each do |k, (v, _)|
    if v.respond_to?(:call)
      initial[k] = v.call
    elsif !v.nil?
      initial[k] = v
    end
  end
  assets.reduce(initial) do |h, asset|
    reducers.each do |k, (_, block)|
      value = k == :data ? asset.source : asset.metadata[k]
      if h.key?(k)
        if !value.nil?
          h[k] = block.call(h[k], value)
        end
      else
        h[k] = value
      end
    end
    h
  end
end