Module: BulkCsvParser::Storage::LocalAdapter
- Defined in:
- lib/bulk_csv_parser/storage.rb
Overview
Copies to local disk. Only correct when the enqueuing process and the job's execution process share that disk.
Class Method Summary collapse
Class Method Details
.cleanup(reference) ⇒ Object
66 67 68 |
# File 'lib/bulk_csv_parser/storage.rb', line 66 def cleanup(reference) File.delete(reference) if reference && File.exist?(reference) end |
.fetch(reference) ⇒ Object
62 63 64 |
# File 'lib/bulk_csv_parser/storage.rb', line 62 def fetch(reference) reference # already a local path end |
.store(file) ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'lib/bulk_csv_parser/storage.rb', line 53 def store(file) dir = BulkCsvParser.configuration.upload_dir FileUtils.mkdir_p(dir) destination = File.join(dir.to_s, "#{SecureRandom.uuid}.csv") FileUtils.cp(file.path, destination) destination end |