Class: Para::ActiveStorageDownloader
- Inherits:
-
Object
- Object
- Para::ActiveStorageDownloader
- Includes:
- ActiveStorage::Downloading
- Defined in:
- lib/para/active_storage_downloader.rb
Instance Attribute Summary collapse
-
#attachment ⇒ Object
readonly
Returns the value of attribute attachment.
Instance Method Summary collapse
-
#download_blob_to_tempfile(&block) ⇒ Object
For versions of ActiveStorage that don’t have an ActiveStorage::Downloading module, we define the method ourselves, as defined in the ActiveStorage::Analyzer and ActiveStorage::Previewer classes, which is simple enough to be copied here.
-
#initialize(attachment) ⇒ ActiveStorageDownloader
constructor
A new instance of ActiveStorageDownloader.
Constructor Details
#initialize(attachment) ⇒ ActiveStorageDownloader
Returns a new instance of ActiveStorageDownloader.
9 10 11 |
# File 'lib/para/active_storage_downloader.rb', line 9 def initialize() @attachment = end |
Instance Attribute Details
#attachment ⇒ Object (readonly)
Returns the value of attribute attachment.
5 6 7 |
# File 'lib/para/active_storage_downloader.rb', line 5 def @attachment end |
Instance Method Details
#download_blob_to_tempfile(&block) ⇒ Object
For versions of ActiveStorage that don’t have an ActiveStorage::Downloading module, we define the method ourselves, as defined in the ActiveStorage::Analyzer and ActiveStorage::Previewer classes, which is simple enough to be copied here.
20 21 22 |
# File 'lib/para/active_storage_downloader.rb', line 20 def download_blob_to_tempfile(&block) blob.open tmpdir: Dir.tmpdir, &block end |