Module: CarrierWave::Uploader::Processing

Extended by:
ActiveSupport::Concern
Includes:
Callbacks
Included in:
Base
Defined in:
lib/carrierwave/uploader/processing.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Methods included from Callbacks

#with_callbacks

Instance Method Details

#process!(new_file = nil) ⇒ Object

Apply all process callbacks added through CarrierWave.process



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/carrierwave/uploader/processing.rb', line 71

def process!(new_file=nil)
  return unless enable_processing

  with_callbacks(:process, new_file) do
    self.class.processors.each do |method, args, condition|
      if(condition)
        if condition.respond_to?(:call)
          next unless condition.call(self, :args => args, :method => method, :file => new_file)
        else
          next unless self.send(condition, new_file)
        end
      end
      self.send(method, *args)
    end
  end
end