module Sprockets::ProcessorUtils
def call_processor(processor, input)
input - Hash of input data to pass to processor
processor - Processor callables
Public: Invoke processor.
def call_processor(processor, input) metadata = (input[:metadata] || {}).dup metadata[:data] = input[:data] case result = processor.call({data: "", metadata: {}}.merge(input)) when NilClass metadata when Hash metadata.merge(result) when String metadata.merge(data: result) else raise TypeError, "invalid processor return type: #{result.class}" end end