Flowdock
method

buffer_filling

Importance_0
v1_8_7_72 - Show latest stable - 0 notes - Class: Net::InternetMessageIO
buffer_filling(buf, src) private

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/net/protocol.rb, line 308
    def buffer_filling(buf, src)
      case src
      when String    # for speeding up.
        0.step(src.size - 1, 1024) do |i|
          buf << src[i, 1024]
          yield
        end
      when File    # for speeding up.
        while s = src.read(1024)
          buf << s
          yield
        end
      else    # generic reader
        src.each do |s|
          buf << s
          yield if buf.size > 1024
        end
        yield unless buf.empty?
      end
    end
Register or log in to add new notes.