Module: CSVPlusPlus::Writer::FileBackerUpper
- Extended by:
- T::Sig
- Includes:
- Kernel
- Included in:
- CSV, Excel, OpenDocument
- Defined in:
- lib/csv_plus_plus/writer/file_backer_upper.rb
Overview
A module that can be mixed into any Writer that needs to back up it’s @output_filename (all of them except Google Sheets)
Instance Method Summary collapse
-
#backup_file(options) ⇒ Object
Assuming the underlying spreadsheet is file-based, create a backup of it.
Instance Method Details
#backup_file(options) ⇒ Object
Assuming the underlying spreadsheet is file-based, create a backup of it
26 27 28 29 30 31 32 33 34 |
# File 'lib/csv_plus_plus/writer/file_backer_upper.rb', line 26 def backup_file() return unless ::File.exist?(.output_filename) # TODO: also don't do anything if the current backups contents haven't changed (do a md5sum or something) attempt_backups().tap do |backed_up_to| puts("Backed up #{.output_filename} to #{backed_up_to}") if .verbose end end |