Update the object using the data provided in the first line in CSV. Options:
The headers to use for the CSV line. Use nil for a header to specify the column should be ignored.
# File lib/sequel/plugins/csv_serializer.rb, line 132 def from_csv(csv, opts = OPTS) row = CSV.parse_line(csv, model.process_csv_serializer_opts(opts)).to_hash row.delete(nil) set(row) end
Return a string in CSV format. Accepts the same options as CSV.new, as well as the following options:
Symbol or Array of Symbols of columns not to include in the CSV output.
Symbol or Array of Symbols of columns to include in the CSV output, ignoring all other columns
Symbol or Array of Symbols specifying non-column attributes to include in the CSV output.
# File lib/sequel/plugins/csv_serializer.rb, line 147 def to_csv(opts = OPTS) opts = model.process_csv_serializer_opts(opts) CSV.generate(opts) do |csv| csv << opts[:headers].map{|k| public_send(k)} end end