module FileWorker

Constants

BACKUP_FILE_NAME

Public Instance Methods

read_backup() click to toggle source
# File lib/file_worker.rb, line 16
def read_backup
  YAML.load_file("data/#{BACKUP_FILE_NAME}")
end
write_backup(raw_yaml) click to toggle source
# File lib/file_worker.rb, line 9
def write_backup(raw_yaml)
  create_data_dir_if_not_exist
  File.open("data/#{BACKUP_FILE_NAME}", 'w+') do |f|
    f.write(raw_yaml)
  end
end

Private Instance Methods

create_data_dir_if_not_exist() click to toggle source
# File lib/file_worker.rb, line 22
def create_data_dir_if_not_exist
  FileUtils.mkdir_p('data')
end