In: |
openssl/lib/openssl/buffering.rb
|
BLOCK_SIZE | = | 1024*16 |
sync | [RW] |
# File openssl/lib/openssl/buffering.rb, line 84 def each(eol=$/) while line = self.gets(eol?) yield line end end
# File openssl/lib/openssl/buffering.rb, line 124 def eof? @eof ||= nil @eof && @rbuffer.size == 0 end
# File openssl/lib/openssl/buffering.rb, line 187 def flush osync = @sync @sync = true do_write "" @sync = osync end
# File openssl/lib/openssl/buffering.rb, line 67 def gets(eol=$/) fill_rbuff unless defined? @rbuffer idx = @rbuffer.index(eol) @eof ||= nil 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 175 def print(*args) s = "" args.each{ |arg| s << arg.to_s } do_write(s) nil end
# File openssl/lib/openssl/buffering.rb, line 163 def puts(*args) s = "" args.each{|arg| s << arg.to_s unless /#{$/}\Z/o =~ s s << $/ end } do_write(s) nil end
# File openssl/lib/openssl/buffering.rb, line 57 def read(size=nil) fill_rbuff unless defined? @rbuffer @eof ||= nil until @eof break if size && size <= @rbuffer.size fill_rbuff end consume_rbuff(size) end
# File openssl/lib/openssl/buffering.rb, line 99 def readline(eol=$/) raise EOFErorr if eof? gets(eol) end
# File openssl/lib/openssl/buffering.rb, line 91 def readlines(eol=$/) ary = [] while line = self.gets(eol) ary << line end ary end