PHP 8.2.31
Preview: stringio.rb Size: 1.98 KB
/proc/thread-self/root/opt/alt/ruby19/lib64/ruby/1.9.1/syck/stringio.rb

warn "#{caller[0]}: yaml/stringio is deprecated" if $VERBOSE

#
# Limited StringIO if no core lib is available
#
begin
require 'stringio'
rescue LoadError
    # StringIO based on code by MoonWolf
    class StringIO
        def initialize(string="")
            @string=string
            @pos=0
            @eof=(string.size==0)
        end
        def pos
            @pos
        end
        def eof
            @eof
        end
        alias eof? eof
        def readline(rs=$/)
            if @eof
                raise EOFError
            else
                if p = @string[@pos..-1]=~rs
                    line = @string[@pos,p+1]
                else
                    line = @string[@pos..-1]
                end
                @pos+=line.size
                @eof =true if @pos==@string.size
                $_ = line
            end
        end
        def rewind
            seek(0,0)
        end
        def seek(offset,whence)
            case whence
            when 0
                @pos=offset
            when 1
                @pos+=offset
            when 2
                @pos=@string.size+offset
            end
            @eof=(@pos>=@string.size)
            0
        end
    end

	#
	# Class method for creating streams
	#
	def Syck.make_stream( io )
        if String === io
            io = StringIO.new( io )
        elsif not IO === io
            raise Syck::Error, "YAML stream must be an IO or String object."
        end
        if Syck::unicode
            def io.readline
                Syck.utf_to_internal( readline( @ln_sep ), @utf_encoding )
            end
            def io.check_unicode
                @utf_encoding = Syck.sniff_encoding( read( 4 ) )
                @ln_sep = Syck.enc_separator( @utf_encoding )
                seek( -4, IO::SEEK_CUR )
            end
		    def io.utf_encoding
		    	@utf_encoding
		    end
            io.check_unicode
        else
            def io.utf_encoding
                :None
            end
        end
        io
	end

end

Directory Contents

Dirs: 0 × Files: 14

Name Size Perms Modified Actions
4.85 KB lrw-r--r-- 2010-04-03 21:50:47
Edit Download
6.47 KB lrw-r--r-- 2010-07-19 04:54:06
Edit Download
1.16 KB lrw-r--r-- 2010-04-03 21:50:47
Edit Download
751 B lrw-r--r-- 2010-04-03 21:50:47
Edit Download
1.04 KB lrw-r--r-- 2010-04-03 21:50:47
Edit Download
296 B lrw-r--r-- 2010-04-03 21:50:47
Edit Download
14.49 KB lrw-r--r-- 2012-03-06 02:43:21
Edit Download
768 B lrw-r--r-- 2010-04-03 21:50:47
Edit Download
1.98 KB lrw-r--r-- 2010-04-03 21:50:47
Edit Download
194 B lrw-r--r-- 2011-05-15 11:55:52
Edit Download
3.16 KB lrw-r--r-- 2010-04-16 20:31:59
Edit Download
4.88 KB lrw-r--r-- 2010-04-03 21:50:47
Edit Download
1.19 KB lrw-r--r-- 2010-04-03 21:50:47
Edit Download
1.35 KB lrw-r--r-- 2010-04-03 21:50:47
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).