module CSVConv::Formatter
Format Hash Array
Public Class Methods
json(hash_array)
click to toggle source
# 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)
click to toggle source
# 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)
click to toggle source
# File lib/csvconv/formatter.rb, line 13 def yaml(hash_array) hash_array.to_yaml end
Private Instance Methods
json(hash_array)
click to toggle source
# 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)
click to toggle source
# 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)
click to toggle source
# File lib/csvconv/formatter.rb, line 13 def yaml(hash_array) hash_array.to_yaml end