lib/bulldog/attachment/base.rb in bulldog-0.0.8 vs lib/bulldog/attachment/base.rb in bulldog-0.0.9
- old
+ new
@@ -21,19 +21,22 @@
#
# Run the processors for the named event.
#
# Return true if no errors were encountered, false otherwise.
#
- def process(event_name)
+ def process(event_name, options={})
reflection.events[event_name].each do |event|
if (types = event.attachment_types)
next unless types.include?(type)
end
processor_type = event.processor_type || default_processor_type
processor_class = Processor.const_get(processor_type.to_s.camelize)
- processor = processor_class.new(self, styles_for_event(event), stream.path)
- processor.process(&event.callback)
+ processor = processor_class.new(self, stream.path)
+ styles = reflection.styles
+ names = options[:styles] || event.styles and
+ styles = reflection.styles.slice(*names)
+ processor.process(styles, options, &event.callback)
end
record.errors.empty?
end
#
@@ -141,17 +144,9 @@
def run_examination
true
end
private # -------------------------------------------------------
-
- def styles_for_event(event)
- if event.styles
- styles = reflection.styles.slice(*event.styles)
- else
- styles = reflection.styles
- end
- end
#
# Remove the files for this attachment, along with any parent
# directories.
#