Method: CsvObject#to_file

Defined in:
lib/csv_object.rb

#to_file(path) ⇒ Object



84
85
86
87
88
89
90
91
# File 'lib/csv_object.rb', line 84

def to_file(path)
  CSV.open(path, 'wb') do |file|
    file << headers
    to_h.each do |hash|
      file << hash.values_at(*headers)
    end
  end
end