Module: BaseFileBuilder

Included in:
Tabled
Defined in:
lib/file_builders/base_file_builder.rb

Instance Method Summary collapse

Instance Method Details

#export_to_file(file_name: 'tabled.csv', format: :csv) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/file_builders/base_file_builder.rb', line 7

def export_to_file(file_name: 'tabled.csv', format: :csv)
  case format
  when :csv
    FileBuilders::CSVFileBuilder.new(data, file_name, options).export_to_file
  when :json
    FileBuilders::JSONFileBuilder.new(data, file_name, options).export_to_file
  else
    raise 'Not implemented yet'
  end
end