Method: IOExtras::AbstractInputStream#gets

Defined in:
lib/zip/ioextras.rb

#gets(aSepString = $/) ⇒ Object



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/zip/ioextras.rb', line 79

def gets(aSepString=$/)
  @lineno = @lineno.next
  return read if aSepString == nil
  aSepString="#{$/}#{$/}" if aSepString == ""
  
  bufferIndex=0
  while ((matchIndex = @outputBuffer.index(aSepString, bufferIndex)) == nil)
  bufferIndex=@outputBuffer.length
  if input_finished?
    return @outputBuffer.empty? ? nil : flush 
  end
  @outputBuffer << produce_input
  end
  sepIndex=matchIndex + aSepString.length
  return @outputBuffer.slice!(0...sepIndex)
end