Module: Pal::Operation::FileExportable

Included in:
CsvExporterImpl
Defined in:
lib/pal/operation/exporter.rb

Instance Method Summary collapse

Instance Method Details

#write_to_file(file_path, file_name, file_extension, contents) ⇒ Object

Parameters:

  • file_path (String)
  • contents (String)
  • file_extension (String)


107
108
109
110
111
112
# File 'lib/pal/operation/exporter.rb', line 107

def write_to_file(file_path, file_name, file_extension, contents)
  file_location = "#{file_path}/#{file_name || Time.now.utc.strftime("%Y-%m-%dT%H:%M:%S%-z")}"
  Pal::Common::LocalFileUtils.with_file(file_location, file_extension) do |file|
    file.write(contents)
  end
end