Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more
# File openssl/lib/openssl/buffering.rb, line 197 def << (s) do_write(s) self end
# File openssl/lib/openssl/buffering.rb, line 236 def close flush rescue nil sysclose end
# File openssl/lib/openssl/buffering.rb, line 118 def each(eol=$/) while line = self.gets(eol) yield line end end
# File openssl/lib/openssl/buffering.rb, line 143 def each_byte while c = getc yield(c) end end
# File openssl/lib/openssl/buffering.rb, line 158 def eof? fill_rbuff if !@eof && @rbuffer.empty? @eof && @rbuffer.empty? end
# File openssl/lib/openssl/buffering.rb, line 229 def flush osync = @sync @sync = true do_write "" @sync = osync end
# File openssl/lib/openssl/buffering.rb, line 138 def getc c = read(1) c ? c[0] : nil end
# File openssl/lib/openssl/buffering.rb, line 103 def gets(eol=$/) idx = @rbuffer.index(eol) until @eof break if idx fill_rbuff idx = @rbuffer.index(eol) end if eol.is_a?(Regexp) size = idx ? idx+$&.size : nil else size = idx ? idx+eol.size : nil end consume_rbuff(size) end
# File openssl/lib/openssl/buffering.rb, line 217 def print(*args) s = "" args.each{ |arg| s << arg.to_s } do_write(s) nil end
# File openssl/lib/openssl/buffering.rb, line 224 def printf(s, *args) do_write(s % args) nil end
# File openssl/lib/openssl/buffering.rb, line 202 def puts(*args) s = "" if args.empty? s << "\n" end args.each{|arg| s << arg.to_s if $/ && /\n\z/ !~ s s << "\n" end } do_write(s) nil end
# File openssl/lib/openssl/buffering.rb, line 57 def read(size=nil, buf=nil) if size == 0 if buf buf.clear else buf = "" end return @eof ? nil : buf end until @eof break if size && size <= @rbuffer.size fill_rbuff end ret = consume_rbuff(size) || "" if buf buf.replace(ret) ret = buf end (size && ret.empty?) ? nil : ret end
# File openssl/lib/openssl/buffering.rb, line 149 def readchar raise EOFError if eof? getc end
# File openssl/lib/openssl/buffering.rb, line 133 def readline(eol=$/) raise EOFError if eof? gets(eol) end
# File openssl/lib/openssl/buffering.rb, line 125 def readlines(eol=$/) ary = [] while line = self.gets(eol) ary << line end ary end
# File openssl/lib/openssl/buffering.rb, line 78 def readpartial(maxlen, buf=nil) if maxlen == 0 if buf buf.clear else buf = "" end return @eof ? nil : buf end if @rbuffer.empty? begin return sysread(maxlen, buf) rescue Errno::EAGAIN retry end end ret = consume_rbuff(maxlen) if buf buf.replace(ret) ret = buf end raise EOFError if ret.empty? ret end