| Class | StringIO |
| In: |
yaml/stringio.rb
|
| Parent: | Object |
Public Class methods
# File yaml/stringio.rb, line 9
9: def initialize(string="")
10: @string=string
11: @pos=0
12: @eof=(string.size==0)
13: end
Public Instance methods
# File yaml/stringio.rb, line 21
21: def readline(rs=$/)
22: if @eof
23: raise EOFError
24: else
25: if p = @string[@pos..-1]=~rs
26: line = @string[@pos,p+1]
27: else
28: line = @string[@pos..-1]
29: end
30: @pos+=line.size
31: @eof =true if @pos==@string.size
32: $_ = line
33: end
34: end