Class: Hotdog::Formatters::Csv
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- Hotdog::Formatters::Csv
- Defined in:
- lib/hotdog/formatters/csv.rb
Instance Method Summary collapse
Instance Method Details
#format(result, options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/hotdog/formatters/csv.rb', line 8 def format(result, ={}) result = prepare(result) if [:headers] and [:fields] result.unshift([:fields]) end CSV.generate { |csv| result.each do |row| csv << row end } end |