Module: DelayedPaperclip::Attachment::InstanceMethods
- Defined in:
- lib/delayed_paperclip/attachment.rb
Instance Method Summary collapse
- #delay_processing? ⇒ Boolean
- #post_process_styles_with_processing(*args) ⇒ Object
- #post_processing_with_delay ⇒ Object
- #post_processing_with_delay=(value) ⇒ Object
- #process_delayed! ⇒ Object
- #processing? ⇒ Boolean
- #save_with_prepare_enqueueing ⇒ Object
- #url_with_processed(style = default_style, include_updated_timestamp = @use_timestamp) ⇒ Object
Instance Method Details
#delay_processing? ⇒ Boolean
24 25 26 27 28 29 30 |
# File 'lib/delayed_paperclip/attachment.rb', line 24 def delay_processing? if @post_processing_with_delay.nil? !!@instance.class.[@name][:delayed] else !@post_processing_with_delay end end |
#post_process_styles_with_processing(*args) ⇒ Object
42 43 44 45 |
# File 'lib/delayed_paperclip/attachment.rb', line 42 def post_process_styles_with_processing(*args) post_process_styles_without_processing(*args) instance.update_attribute("#{name}_processing", false) if instance.respond_to?(:"#{name}_processing?") end |
#post_processing_with_delay ⇒ Object
16 17 18 |
# File 'lib/delayed_paperclip/attachment.rb', line 16 def post_processing_with_delay !delay_processing? end |
#post_processing_with_delay=(value) ⇒ Object
20 21 22 |
# File 'lib/delayed_paperclip/attachment.rb', line 20 def post_processing_with_delay=(value) @post_processing_with_delay = value end |
#process_delayed! ⇒ Object
36 37 38 39 40 |
# File 'lib/delayed_paperclip/attachment.rb', line 36 def process_delayed! self.job_is_processing = true reprocess! self.job_is_processing = false end |
#processing? ⇒ Boolean
32 33 34 |
# File 'lib/delayed_paperclip/attachment.rb', line 32 def processing? @instance.send(:"#{@name}_processing?") end |
#save_with_prepare_enqueueing ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'lib/delayed_paperclip/attachment.rb', line 47 def save_with_prepare_enqueueing was_dirty = @dirty save_without_prepare_enqueueing.tap do if delay_processing? && was_dirty instance.prepare_enqueueing_for name end end end |
#url_with_processed(style = default_style, include_updated_timestamp = @use_timestamp) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/delayed_paperclip/attachment.rb', line 56 def url_with_processed style = default_style, = @use_timestamp return url_without_processed style, if !@instance.class.[@name][:delayed].try(:[], :url_with_processing) || job_is_processing if !@instance.respond_to?(:"#{name}_processing?") url_without_processed style, else if !processing? url_without_processed style, else if dirty? url_without_processed style, else interpolate(@default_url, style) end end end end |