Sha256: e32e98c426c74d3e347d259fdf725e30009b74fecd94c021416a7e77c2b75a7c

Contents?: true

Size: 474 Bytes

Versions: 6

Compression:

Stored size: 474 Bytes

Contents

class IO
  def read_available_bytes(chunk_size = 16384, select_timeout = 0.02)
    buffer = []

    return "" if closed? || eof?
    # IO.select cannot be used here due to the fact that it
    # just does not work on windows
    while true
      begin
        IO.select([self], nil, nil, select_timeout)
        break if eof? # stop raising :-(
        buffer << self.readpartial(chunk_size)
      rescue(EOFError)
        break
      end
    end

    buffer.join
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
redpomo-reloaded-0.0.14 spec/support/ruby_ext.rb
redpomo-reloaded-0.0.13 ./spec/support/ruby_ext.rb
redpomo-0.0.13 spec/support/ruby_ext.rb
redpomo-0.0.12 spec/support/ruby_ext.rb
redpomo-0.0.11 spec/support/ruby_ext.rb
redpomo-0.0.10 spec/support/ruby_ext.rb