Class: ActiveStorage::Downloader
- Inherits:
-
Object
- Object
- ActiveStorage::Downloader
- Defined in:
- lib/active_storage/downloader.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#service ⇒ Object
readonly
Returns the value of attribute service.
Instance Method Summary collapse
-
#initialize(service) ⇒ Downloader
constructor
A new instance of Downloader.
- #open(key, checksum:, name: "ActiveStorage-", tmpdir: nil) ⇒ Object
Constructor Details
#initialize(service) ⇒ Downloader
Returns a new instance of Downloader.
7 8 9 |
# File 'lib/active_storage/downloader.rb', line 7 def initialize(service) @service = service end |
Instance Attribute Details
#service ⇒ Object (readonly)
Returns the value of attribute service.
5 6 7 |
# File 'lib/active_storage/downloader.rb', line 5 def service @service end |
Instance Method Details
#open(key, checksum:, name: "ActiveStorage-", tmpdir: nil) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/active_storage/downloader.rb', line 11 def open(key, checksum:, name: "ActiveStorage-", tmpdir: nil) open_tempfile(name, tmpdir) do |file| download key, file verify_integrity_of file, checksum: checksum yield file end end |