2 # Limited StringIO if no core lib is available
7 # StringIO based on code by MoonWolf
9 def initialize(string="")
25 if p = @string[@pos..-1]=~rs
26 line = @string[@pos,p+1]
28 line = @string[@pos..-1]
31 @eof =true if @pos==@string.size
38 def seek(offset,whence)
45 @pos=@string.size+offset
47 @eof=(@pos>=@string.size)
53 # Class method for creating streams
55 def YAML.make_stream( io )
57 io = StringIO.new( io )
59 raise YAML::Error, "YAML stream must be an IO or String object."
63 YAML.utf_to_internal( readline( @ln_sep ), @utf_encoding )
66 @utf_encoding = YAML.sniff_encoding( read( 4 ) )
67 @ln_sep = YAML.enc_separator( @utf_encoding )
68 seek( -4, IO::SEEK_CUR )