Module: FlatFile::TSV

Defined in:
lib/flat_file/tsv.rb

Class Method Summary collapse

Class Method Details

.from_file(filepath, delim: "\t") ⇒ Array<Hash{String => String}>

Read a TSV file and return its contents as an array of hashes.



11
12
13
14
15
16
17
18
# File 'lib/flat_file/tsv.rb', line 11

def self.from_file(filepath, delim: "\t")
  return ::CSV.read(
    filepath,
    col_sep: delim,
    headers: true,
    quote_char: "\x00",
  ).map(&:to_hash)
end