Class: Hotdog::Formatters::Ltsv
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- Hotdog::Formatters::Ltsv
- Defined in:
- lib/hotdog/formatters/ltsv.rb
Instance Method Summary collapse
Instance Method Details
#format(result, options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/hotdog/formatters/ltsv.rb', line 6 def format(result, ={}) result = prepare(result) if [:fields] result.map { |row| [:fields].zip(row).map { |(field, column)| "#{field}:#{column}" }.join("\t") }.join(newline) + newline else result.map { |row| row.join("\t") }.join(newline) + newline end end |