Module: Hprose::Stream
Overview
module Tags
Instance Method Summary collapse
Instance Method Details
#readint(stream, char) ⇒ Object
98 99 100 101 102 |
# File 'lib/hprose/io.rb', line 98 def readint(stream, char) s = readuntil(stream, char) return 0 if s == '' return s.to_i end |
#readuntil(stream, char) ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/hprose/io.rb', line 87 def readuntil(stream, char) s = StringIO.new while true do c = stream.getbyte break if c.nil? or (c == char) s.putc(c) end result = s.string s.close return result end |