Sha256: 99319e90a21ee20e8ef819983c1ea5521212793a11eb62391cd9bb86392c8691

Contents?: true

Size: 423 Bytes

Versions: 18

Compression:

Stored size: 423 Bytes

Contents

# Many importers use this as a standard. This works like a wrapper for any
# IO object with a couple extra methods added.
class Tracksperanto::ExtIO < DelegateClass(IO)
  def initialize(with)
    __setobj__ with
  end
  
  def gets_and_strip
    s = gets
    s ? s.strip : nil
  end
  
  def gets_non_empty
    line = gets
    return nil if line.nil?
    s = line.strip
    return gets_non_empty if s.empty?
    s
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
tracksperanto-2.1.0 lib/tracksperanto/ext_io.rb
tracksperanto-2.0.2 lib/tracksperanto/ext_io.rb
tracksperanto-2.0.1 lib/tracksperanto/ext_io.rb
tracksperanto-2.0.0 lib/tracksperanto/ext_io.rb
tracksperanto-1.9.9 lib/tracksperanto/ext_io.rb
tracksperanto-1.9.8 lib/tracksperanto/ext_io.rb
tracksperanto-1.9.6 lib/tracksperanto/ext_io.rb
tracksperanto-1.9.5 lib/tracksperanto/ext_io.rb
tracksperanto-1.9.4 lib/tracksperanto/ext_io.rb
tracksperanto-1.9.3 lib/tracksperanto/ext_io.rb
tracksperanto-1.9.2 lib/tracksperanto/ext_io.rb
tracksperanto-1.9.1 lib/tracksperanto/ext_io.rb
tracksperanto-1.9.0 lib/tracksperanto/ext_io.rb
tracksperanto-1.8.4 lib/tracksperanto/ext_io.rb
tracksperanto-1.8.2 lib/tracksperanto/ext_io.rb
tracksperanto-1.8.1 lib/tracksperanto/ext_io.rb
tracksperanto-1.8.0 lib/tracksperanto/ext_io.rb
tracksperanto-1.7.5 lib/tracksperanto/ext_io.rb