Class: DelayedPaperclip::UrlGenerator
- Inherits:
-
Paperclip::UrlGenerator
- Object
- Paperclip::UrlGenerator
- DelayedPaperclip::UrlGenerator
- Defined in:
- lib/delayed_paperclip/url_generator.rb
Instance Method Summary collapse
- #delayed_default_url?(style = nil) ⇒ Boolean
- #for(style_name, options) ⇒ Object
-
#initialize(attachment, _compatibility = nil) ⇒ UrlGenerator
constructor
A new instance of UrlGenerator.
-
#most_appropriate_url(style = nil) ⇒ Object
This method is a mess.
- #timestamp_possible? ⇒ Boolean
Constructor Details
#initialize(attachment, _compatibility = nil) ⇒ UrlGenerator
Returns a new instance of UrlGenerator.
6 7 8 9 |
# File 'lib/delayed_paperclip/url_generator.rb', line 6 def initialize(, _compatibility = nil) @attachment = @attachment_options = . end |
Instance Method Details
#delayed_default_url?(style = nil) ⇒ Boolean
46 47 48 49 50 51 52 |
# File 'lib/delayed_paperclip/url_generator.rb', line 46 def delayed_default_url?(style = nil) return false if @attachment.job_is_processing return false if @attachment.dirty? return false if not @attachment..try(:[], :url_with_processing) return false if not processing?(style) true end |
#for(style_name, options) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/delayed_paperclip/url_generator.rb', line 11 def for(style_name, ) most_appropriate_url = @attachment.processing_style?(style_name) ? most_appropriate_url(style_name) : most_appropriate_url() ( escape_url_as_needed( @attachment_options[:interpolator].interpolate(most_appropriate_url, @attachment, style_name), ), ) end |
#most_appropriate_url(style = nil) ⇒ Object
This method is a mess
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/delayed_paperclip/url_generator.rb', line 22 def most_appropriate_url(style = nil) if @attachment.processing_style?(style) if @attachment.original_filename.nil? || delayed_default_url?(style) if @attachment..nil? || @attachment.processing_image_url.nil? || !@attachment.processing? default_url else @attachment.processing_image_url end else @attachment_options[:url] end else super() end end |
#timestamp_possible? ⇒ Boolean
42 43 44 |
# File 'lib/delayed_paperclip/url_generator.rb', line 42 def delayed_default_url? ? false : super end |