Class: Sqldump::CsvFormatter
- Inherits:
-
Object
- Object
- Sqldump::CsvFormatter
- Defined in:
- lib/sqldump/csv_formatter.rb
Instance Method Summary collapse
-
#initialize(sth, io, options) ⇒ CsvFormatter
constructor
A new instance of CsvFormatter.
- #output ⇒ Object
Constructor Details
#initialize(sth, io, options) ⇒ CsvFormatter
Returns a new instance of CsvFormatter.
5 6 7 8 9 |
# File 'lib/sqldump/csv_formatter.rb', line 5 def initialize(sth, io, ) @sth = sth @io = io @options = end |
Instance Method Details
#output ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/sqldump/csv_formatter.rb', line 11 def output if @options.csv_header @io.puts @sth.column_names.join(",") end @sth.fetch do |row| @io.puts row.join(",") end end |