Class: Tartarus::RemoteStorage::Glacier::CsvExport
- Inherits:
-
Object
- Object
- Tartarus::RemoteStorage::Glacier::CsvExport
- Defined in:
- lib/tartarus/remote_storage/glacier/csv_export.rb
Instance Method Summary collapse
- #export(collection, path_to_file) ⇒ Object
-
#initialize(storage_directory, file_service: ::File, file_utils: FileUtils) ⇒ CsvExport
constructor
A new instance of CsvExport.
Constructor Details
#initialize(storage_directory, file_service: ::File, file_utils: FileUtils) ⇒ CsvExport
Returns a new instance of CsvExport.
14 15 16 17 18 |
# File 'lib/tartarus/remote_storage/glacier/csv_export.rb', line 14 def initialize(storage_directory, file_service: ::File, file_utils: FileUtils) @storage_directory = storage_directory @file_service = file_service @file_utils = file_utils end |
Instance Method Details
#export(collection, path_to_file) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/tartarus/remote_storage/glacier/csv_export.rb', line 20 def export(collection, path_to_file) with_csv_export_file(path_to_file) do |file| collection.copy_to(NO_PATH_FOR_EXPORT, delimiter: DELIMITER) do |line| file.write(line.force_encoding(ENCODING)) end end end |