Module: Roo::Formatters::CSV
- Included in:
- Base
- Defined in:
- lib/roo/formatters/csv.rb
Instance Method Summary collapse
Instance Method Details
#to_csv(filename = nil, separator = ",", sheet = default_sheet) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/roo/formatters/csv.rb', line 4 def to_csv(filename = nil, separator = ",", sheet = default_sheet) if filename File.open(filename, "w") do |file| write_csv_content(file, sheet, separator) end true else sio = ::StringIO.new write_csv_content(sio, sheet, separator) sio.rewind sio.read end end |