Class: Airbrush::Processors::Image::ImageProcessor

Inherits:
Processor show all
Defined in:
lib/airbrush/processors/image/image_processor.rb

Direct Known Subclasses

Rmagick

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Processor

filter_params

Class Method Details

.after_filter(*symbols) ⇒ Object



11
12
13
# File 'lib/airbrush/processors/image/image_processor.rb', line 11

def self.after_filter(*symbols)
  self.after_filters = symbols
end

.before_filter(*symbols) ⇒ Object



7
8
9
# File 'lib/airbrush/processors/image/image_processor.rb', line 7

def self.before_filter(*symbols)
  self.before_filters = symbols
end

Instance Method Details

#dispatch(command, args) ⇒ Object



15
16
17
18
19
20
# File 'lib/airbrush/processors/image/image_processor.rb', line 15

def dispatch(command, args)
  self.before_filters.each { |filter| filter_dispatch(filter, args) } if self.before_filters
  rv = super command, args
  self.after_filters.each { |filter| filter_dispatch(filter, args) } if self.after_filters
  rv
end

#filter_dispatch(command, args) ⇒ Object



22
23
24
25
26
# File 'lib/airbrush/processors/image/image_processor.rb', line 22

def filter_dispatch(command, args)
  raise "Unknown processor operation #{command} (#{args.inspect unless args.blank?})" unless self.respond_to? command
  params = assign(command, args)
  self.send command, *params
end