Class: ActiveStorageDownloader
- Inherits:
-
Object
- Object
- ActiveStorageDownloader
- Defined in:
- lib/clowne_active_storage/helpers/active_storage_downloader.rb
Overview
Instance Attribute Summary collapse
-
#blob ⇒ Object
readonly
Returns the value of attribute blob.
-
#tempdir ⇒ Object
readonly
Returns the value of attribute tempdir.
Instance Method Summary collapse
- #download_blob_to_tempfile ⇒ Object
-
#initialize(blob, tempdir: nil) ⇒ ActiveStorageDownloader
constructor
A new instance of ActiveStorageDownloader.
Constructor Details
#initialize(blob, tempdir: nil) ⇒ ActiveStorageDownloader
Returns a new instance of ActiveStorageDownloader.
7 8 9 10 |
# File 'lib/clowne_active_storage/helpers/active_storage_downloader.rb', line 7 def initialize(blob, tempdir: nil) @blob = blob @tempdir = tempdir end |
Instance Attribute Details
#blob ⇒ Object (readonly)
Returns the value of attribute blob.
6 7 8 |
# File 'lib/clowne_active_storage/helpers/active_storage_downloader.rb', line 6 def blob @blob end |
#tempdir ⇒ Object (readonly)
Returns the value of attribute tempdir.
6 7 8 |
# File 'lib/clowne_active_storage/helpers/active_storage_downloader.rb', line 6 def tempdir @tempdir end |
Instance Method Details
#download_blob_to_tempfile ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/clowne_active_storage/helpers/active_storage_downloader.rb', line 12 def download_blob_to_tempfile open_tempfile do |file| download_blob_to file verify_integrity_of file yield file end end |