Sha256: 25dca462007ef8e7214c16cb22e9ace3ef4a6da6506ffc3b3647b41f0917f5ab

Contents?: true

Size: 674 Bytes

Versions: 2

Compression:

Stored size: 674 Bytes

Contents

require 'uri'
module DelayedPaperclip
  module UrlGenerator
    def self.included(base)
      base.send :include, InstanceMethods
      base.alias_method_chain :most_appropriate_url, :processed
    end

    def most_appropriate_url_with_processed
      if @attachment.original_filename.nil? || delayed_default_url?
        default_url
      else
         @attachment_options[:url]
      end
    end

    def delayed_default_url?
      !(@attachment.job_is_processing || @attachment.dirty? || !@attachment.delayed_options.try(:[], :url_with_processing) || !(@attachment.instance.respond_to?(:"#{@attachment.name}_processing?") && @attachment.processing?))
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
delayed_paperclip-2.5.0.1 lib/delayed_paperclip/url_generator.rb
delayed_paperclip-2.4.5.2 lib/delayed_paperclip/url_generator.rb