Class: Airbrush::Processors::Processor

Inherits:
Object
  • Object
show all
Defined in:
lib/airbrush/processors/processor.rb

Direct Known Subclasses

Image::ImageProcessor

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.filter_params(*symbols) ⇒ Object



17
18
19
# File 'lib/airbrush/processors/processor.rb', line 17

def self.filter_params(*symbols)
  self.filtered_params = symbols
end

Instance Method Details

#dispatch(command, args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/airbrush/processors/processor.rb', line 6

def dispatch(command, args)
  raise "Unknown processor operation #{command} (#{filter(args).inspect unless args.blank?})" unless self.respond_to? command
  returning self.send(command, *assign(command, args)) do
    log.debug "Processed #{command} (#{filter(args).inspect unless args.blank?})"
  end
rescue Exception => e
  buffer = "ERROR: Received error during processor dispatch for command '#{command}' (#{filter(args).inspect unless args.blank?})"
  log.error buffer; log.error e
  { :exception => buffer, :message => e.message }
end