Class: Tracksperanto::ExtIO

Inherits:
IO
  • Object
show all
Defined in:
lib/tracksperanto/ext_io.rb

Overview

Many importers use this as a standard. This works like a wrapper for any IO object with a couple extra methods added

Instance Method Summary collapse

Constructor Details

#initialize(with) ⇒ ExtIO

Returns a new instance of ExtIO.



4
5
6
# File 'lib/tracksperanto/ext_io.rb', line 4

def initialize(with)
  __setobj__ with
end

Instance Method Details

#gets_and_stripObject



8
9
10
11
# File 'lib/tracksperanto/ext_io.rb', line 8

def gets_and_strip
  s = __getobj__.gets
  s ? s.strip : nil
end

#gets_non_emptyObject



13
14
15
16
17
18
19
# File 'lib/tracksperanto/ext_io.rb', line 13

def gets_non_empty
  line = __getobj__.gets
  return nil if line.nil?
  s = line.strip
  return gets_non_empty if s.empty?
  s
end