Class: CarrierWave::Storage::Abstract
- Inherits:
-
Object
- Object
- CarrierWave::Storage::Abstract
- Defined in:
- lib/carrierwave/storage/abstract.rb
Overview
This file serves mostly as a specification for Storage engines. There is no requirement that storage engines must be a subclass of this class.
Instance Attribute Summary collapse
-
#uploader ⇒ Object
readonly
Returns the value of attribute uploader.
Instance Method Summary collapse
- #cache!(new_file) ⇒ Object
- #clean_cache!(seconds) ⇒ Object
- #delete_dir!(path) ⇒ Object
- #identifier ⇒ Object
-
#initialize(uploader) ⇒ Abstract
constructor
A new instance of Abstract.
- #retrieve!(identifier) ⇒ Object
- #retrieve_from_cache!(identifier) ⇒ Object
- #store!(file) ⇒ Object
Constructor Details
#initialize(uploader) ⇒ Abstract
Returns a new instance of Abstract.
12 13 14 |
# File 'lib/carrierwave/storage/abstract.rb', line 12 def initialize(uploader) @uploader = uploader end |
Instance Attribute Details
#uploader ⇒ Object (readonly)
Returns the value of attribute uploader.
10 11 12 |
# File 'lib/carrierwave/storage/abstract.rb', line 10 def uploader @uploader end |
Instance Method Details
#cache!(new_file) ⇒ Object
26 27 28 |
# File 'lib/carrierwave/storage/abstract.rb', line 26 def cache!(new_file) raise NotImplementedError, "Need to implement #cache! if you want to use #{self.class.name} as a cache storage." end |
#clean_cache!(seconds) ⇒ Object
38 39 40 |
# File 'lib/carrierwave/storage/abstract.rb', line 38 def clean_cache!(seconds) raise NotImplementedError, "Need to implement #clean_cache! if you want to use #{self.class.name} as a cache storage." end |
#delete_dir!(path) ⇒ Object
34 35 36 |
# File 'lib/carrierwave/storage/abstract.rb', line 34 def delete_dir!(path) raise NotImplementedError, "Need to implement #delete_dir! if you want to use #{self.class.name} as a cache storage." end |
#identifier ⇒ Object
16 17 18 |
# File 'lib/carrierwave/storage/abstract.rb', line 16 def identifier uploader.deduplicated_filename end |
#retrieve!(identifier) ⇒ Object
23 24 |
# File 'lib/carrierwave/storage/abstract.rb', line 23 def retrieve!(identifier) end |
#retrieve_from_cache!(identifier) ⇒ Object
30 31 32 |
# File 'lib/carrierwave/storage/abstract.rb', line 30 def retrieve_from_cache!(identifier) raise NotImplementedError, "Need to implement #retrieve_from_cache! if you want to use #{self.class.name} as a cache storage." end |
#store!(file) ⇒ Object
20 21 |
# File 'lib/carrierwave/storage/abstract.rb', line 20 def store!(file) end |