Sha256: a88262e009d466550d4e4834b6af22ac3368a37b6ef9994421ca16fb429fcf67

Contents?: true

Size: 444 Bytes

Versions: 24

Compression:

Stored size: 444 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 = __getobj__.gets
    s ? s.strip : nil
  end
  
  def gets_non_empty
    line = __getobj__.gets
    return nil if line.nil?
    s = line.strip
    return gets_non_empty if s.empty?
    s
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
tracksperanto-1.7.4 lib/tracksperanto/ext_io.rb
tracksperanto-1.7.3 lib/tracksperanto/ext_io.rb
tracksperanto-1.7.2 lib/tracksperanto/ext_io.rb
tracksperanto-1.7.1 lib/tracksperanto/ext_io.rb
tracksperanto-1.7.0 lib/tracksperanto/ext_io.rb
tracksperanto-1.6.9 lib/tracksperanto/ext_io.rb
tracksperanto-1.6.8 lib/tracksperanto/ext_io.rb
tracksperanto-1.6.7 lib/tracksperanto/ext_io.rb
tracksperanto-1.6.6 lib/tracksperanto/ext_io.rb
tracksperanto-1.6.5 lib/tracksperanto/ext_io.rb
tracksperanto-1.6.4 lib/tracksperanto/ext_io.rb
tracksperanto-1.6.3 lib/tracksperanto/ext_io.rb
tracksperanto-1.6.2 lib/tracksperanto/ext_io.rb
tracksperanto-1.6.1 lib/tracksperanto/ext_io.rb
tracksperanto-1.6.0 lib/tracksperanto/ext_io.rb
tracksperanto-1.5.7 lib/tracksperanto/ext_io.rb
tracksperanto-1.5.6 lib/tracksperanto/ext_io.rb
tracksperanto-1.5.5 lib/tracksperanto/ext_io.rb
tracksperanto-1.5.4 lib/tracksperanto/ext_io.rb
tracksperanto-1.5.3 lib/tracksperanto/ext_io.rb