Sha256: a6b2b5cead4acb974201a5f3b5c9d36b7281bd3eede759f939e78bf86daeb892

Contents?: true

Size: 398 Bytes

Versions: 4

Compression:

Stored size: 398 Bytes

Contents

module MasterRecord
  class TSV
    include Enumerable

    def each
      @datum.each do|data|
        yield data.chomp.split("\t")
      end
    end

    def self.load_file(file,headers=false)
      contents = File.readlines(file)
      if headers
        new(contents[1 .. -1])
      else
        new(contents)
      end
    end

    def initialize(datum)
      @datum = datum
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
MasterRecord-0.3.2 lib/master_record/tsv.rb
MasterRecord-0.3.1 lib/master_record/tsv.rb
MasterRecord-0.3.0 lib/master_record/tsv.rb
MasterRecord-0.2.0 lib/master_record/tsv.rb