lib/delayed_paperclip/attachment.rb in delayed_paperclip-2.9.1 vs lib/delayed_paperclip/attachment.rb in delayed_paperclip-2.9.2

- old
+ new

@@ -2,13 +2,19 @@ module Attachment def self.included(base) base.send :include, InstanceMethods base.send :attr_accessor, :job_is_processing - base.alias_method_chain :post_processing, :delay - base.alias_method_chain :post_processing=, :delay - base.alias_method_chain :save, :prepare_enqueueing + + base.send :alias_method, :post_processing_without_delay, :post_processing + base.send :alias_method, :post_processing, :post_processing_with_delay + + base.send :alias_method, :post_processing_without_delay=, :post_processing= + base.send :alias_method, :post_processing=, :post_processing_with_delay= + + base.send :alias_method, :save_without_prepare_enqueueing, :save + base.send :alias_method, :save, :save_with_prepare_enqueueing end module InstanceMethods def delayed_options @@ -34,25 +40,25 @@ end end def split_processing? options[:only_process] && delayed_options && - options[:only_process] != delayed_options[:only_process] + options[:only_process] != delayed_only_process end def processing? column_name = :"#{@name}_processing?" @instance.respond_to?(column_name) && @instance.send(column_name) end def processing_style?(style) return false if !processing? - !split_processing? || delayed_options[:only_process].include?(style) + !split_processing? || delayed_only_process.include?(style) end def delayed_only_process - only_process = delayed_options[:only_process].dup + only_process = delayed_options.fetch(:only_process, []).dup only_process = only_process.call(self) if only_process.respond_to?(:call) only_process.map(&:to_sym) end def process_delayed!