Class: Hotdog::Formatters::Tsv

Inherits:
BaseFormatter show all
Defined in:
lib/hotdog/formatters/tsv.rb

Instance Method Summary collapse

Instance Method Details

#format(result, options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/hotdog/formatters/tsv.rb', line 6

def format(result, options={})
  result = prepare(result)
  if options[:headers] and options[:fields]
    result.unshift(options[:fields])
  end
  result.map { |row|
    row.join("\t")
  }.join(newline) + newline
end