Sha256: b211ac1950c4dd91708f49cedf0c5724d62784995531dba06ab0cd6ce8d01e2e

Contents?: true

Size: 505 Bytes

Versions: 26

Compression:

Stored size: 505 Bytes

Contents

module Para
  class ActiveStorageDownloader
    if defined?(ActiveStorage)
      include ActiveStorage::Downloading
    end

    attr_reader :attachment
    
    delegate :blob, to: :attachment

    def initialize(attachment)
      @attachment = attachment
    end

    if defined?(ActiveStorage)
      public :download_blob_to_tempfile
    else
      define_method(:download_blob_to_tempfile) do
        raise NoMethodError, "ActiveStorage is not included in your application"
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
para-0.8.2.3 lib/para/active_storage_downloader.rb
para-0.8.2.2 lib/para/active_storage_downloader.rb
para-0.8.2.1 lib/para/active_storage_downloader.rb
para-0.8.2 lib/para/active_storage_downloader.rb
para-0.8.1 lib/para/active_storage_downloader.rb
para-0.8.0 lib/para/active_storage_downloader.rb