module FlatFile::TSV

Public Class Methods

from_file(filepath, delim: "\t") click to toggle source

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

@param filepath [String] Path to the TSV file. @param delim [String] @return [Array<Hash{String => String}>]

# 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