Class: Shrine::Storage::Tus
- Inherits:
-
Url
- Object
- Url
- Shrine::Storage::Tus
- Defined in:
- lib/shrine/storage/tus.rb
Instance Attribute Summary collapse
-
#tus_storage ⇒ Object
readonly
Returns the value of attribute tus_storage.
Instance Method Summary collapse
-
#initialize(tus_storage: nil, **options) ⇒ Tus
constructor
A new instance of Tus.
- #open(id, **options) ⇒ Object
Constructor Details
#initialize(tus_storage: nil, **options) ⇒ Tus
Returns a new instance of Tus.
10 11 12 13 14 |
# File 'lib/shrine/storage/tus.rb', line 10 def initialize(tus_storage: nil, **) @tus_storage = tus_storage super(delete: true, **) end |
Instance Attribute Details
#tus_storage ⇒ Object (readonly)
Returns the value of attribute tus_storage.
8 9 10 |
# File 'lib/shrine/storage/tus.rb', line 8 def tus_storage @tus_storage end |
Instance Method Details
#open(id, **options) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/shrine/storage/tus.rb', line 16 def open(id, **) return super unless tus_storage open_from_tus_storage(tus_uid(id), **) rescue => error raise error unless tus_not_found?(error) raise Shrine::FileNotFound, "file #{id.inspect} not found on storage" end |