lib/delayed_paperclip/attachment.rb in delayed_paperclip-2.6.1 vs lib/delayed_paperclip/attachment.rb in delayed_paperclip-2.7.0
- old
+ new
@@ -11,16 +11,16 @@
end
module InstanceMethods
def delayed_options
- @instance.class.paperclip_definitions[@name][:delayed]
+ @options[:delayed]
end
# Attr accessor in Paperclip
def post_processing_with_delay
- !delay_processing?
+ !delay_processing? || split_processing?
end
def post_processing_with_delay=(value)
@post_processing_with_delay = value
end
@@ -33,22 +33,35 @@
else
!@post_processing_with_delay
end
end
+ def split_processing?
+ options[:only_process] &&
+ options[:only_process] !=
+ options[:delayed][:only_process]
+ end
+
def processing?
- @instance.send(:"#{@name}_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)
+ end
+
def process_delayed!
self.job_is_processing = true
self.post_processing = true
reprocess!(*delayed_options[:only_process])
self.job_is_processing = false
end
def processing_image_url
- processing_image_url = @options[:delayed][:processing_image_url]
+ processing_image_url = delayed_options[:processing_image_url]
processing_image_url = processing_image_url.call(self) if processing_image_url.respond_to?(:call)
processing_image_url
end
# Updates _processing column to false