Class: Tb::TSVReader

Inherits:
Object
  • Object
show all
Defined in:
lib/tb/tsv.rb

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ TSVReader

Returns a new instance of TSVReader.



68
69
70
71
72
73
74
# File 'lib/tb/tsv.rb', line 68

def initialize(input)
  if input.respond_to? :to_str
    @input = StringIO.new(input)
  else
    @input = input
  end
end

Instance Method Details

#shiftObject



76
77
78
79
80
81
82
# File 'lib/tb/tsv.rb', line 76

def shift
  line = @input.gets
  return nil if !line
  line = line.chomp("\n")
  line = line.chomp("\r")
  line.split(/\t/, -1)
end