Module: CarrierWave::Processor::UploaderDsl::ClassMethods

Defined in:
lib/carrierwave/processor/uploader_dsl.rb

Instance Method Summary collapse

Instance Method Details

#use_processor(*args) ⇒ Object Also known as: use_processors



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/carrierwave/processor/uploader_dsl.rb', line 13

def use_processor *args
  options = args.extract_options!
  args.each do |processor|
    if processor and not ::CarrierWave::Processor.processors.blank? and real_processor = ::CarrierWave::Processor.processors[processor] and real_processor[:block]
      new_if = [options[:if], real_processor[:options][:if]]
      merged_options = real_processor[:options].merge options
      merged_options[:if] = new_if if new_if
      Injector.new(self, merged_options, &real_processor[:block])
    else
      raise ProcessorNotFoundError, processor
    end
  end
end