Sha256: 8774335e2474fc13bcdcab095d36dad7b9e98d3d6526740db85b68cb6c16e077
Contents?: true
Size: 642 Bytes
Versions: 1
Compression:
Stored size: 642 Bytes
Contents
require "csv" module Eddy # Read a TSV file and return its contents as an array of hashes. # # @param filepath [String] Path to the TSV file. # @return [Array<Hash>] def self.parse_tsv(filepath) return CSV.read( filepath, col_sep: "\t", headers: true, quote_char: nil, header_converters: :symbol, ).map(&:to_hash) end # Directory where the gem is located. # @return [String] def self.root_dir return File.expand_path("../../..", __FILE__) end # Directory for writing out files. # @return [String] def self.data_dir return File.join(self.root_dir, "data") end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
eddy-0.1.0 | lib/eddy/helpers.rb |