module Sprockets::ProcessorUtils
def validate_processor_result!(result)
result - Metadata Hash returned from call_processors
raise a friendly user error message.
Internal: Validate returned result of calling a processor pipeline and
def validate_processor_result!(result) if !result.instance_of?(Hash) raise TypeError, "processor metadata result was expected to be a Hash, but was #{result.class}" end if !result[:data].instance_of?(String) raise TypeError, "processor :data was expected to be a String, but as #{result[:data].class}" end result.each do |key, value| if !key.instance_of?(Symbol) raise TypeError, "processor metadata[#{key.inspect}] expected to be a Symbol" end end result end