Class: CarrierWave::Storage::File
- Defined in:
- lib/carrierwave/storage/file.rb
Class Method Summary collapse
-
.retrieve!(uploader, identifier) ⇒ CarrierWave::SanitizedFile
Retrieve the file from its store path.
-
.store!(uploader, file) ⇒ CarrierWave::SanitizedFile
Move the file to the uploader’s store path.
Instance Method Summary collapse
-
#initialize(uploader) ⇒ File
constructor
A new instance of File.
Methods inherited from Abstract
#identifier, #path, setup!, #url
Constructor Details
#initialize(uploader) ⇒ File
Returns a new instance of File.
5 6 7 |
# File 'lib/carrierwave/storage/file.rb', line 5 def initialize(uploader) @uploader = uploader end |
Class Method Details
.retrieve!(uploader, identifier) ⇒ CarrierWave::SanitizedFile
Retrieve the file from its store path
32 33 34 35 36 |
# File 'lib/carrierwave/storage/file.rb', line 32 def self.retrieve!(uploader, identifier) path = ::File.join(uploader.store_dir, identifier) path = ::File.(path, uploader.public) CarrierWave::SanitizedFile.new(path) end |
.store!(uploader, file) ⇒ CarrierWave::SanitizedFile
Move the file to the uploader’s store path.
17 18 19 20 21 22 |
# File 'lib/carrierwave/storage/file.rb', line 17 def self.store!(uploader, file) path = ::File.join(uploader.store_dir, uploader.filename) path = ::File.(path, uploader.public) file.move_to(path) file end |