Module: CSVConv::Formatter
- Defined in:
- lib/csvconv/formatter.rb
Overview
Format Hash Array
Class Method Summary collapse
Class Method Details
.json(hash_array) ⇒ Object
7 8 9 10 11 |
# File 'lib/csvconv/formatter.rb', line 7 def json(hash_array) hash_array.map do |hash| hash.to_json + "\n" end.join end |
.ltsv(hash_array) ⇒ Object
17 18 19 20 21 |
# File 'lib/csvconv/formatter.rb', line 17 def ltsv(hash_array) hash_array.map do |hash| hash.map { |key, val| [key, val].join(':') }.join("\t") + "\n" end.join end |
.yaml(hash_array) ⇒ Object
13 14 15 |
# File 'lib/csvconv/formatter.rb', line 13 def yaml(hash_array) hash_array.to_yaml end |