Module: TypeArray::IOReader

Defined in:
lib/type_array/io.rb

Instance Method Summary collapse

Instance Method Details

#read(io, length) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/type_array/io.rb', line 6

def read(io, length)
  buf = nil
  case io
  when BasicSocket
    buf = io.recv(length)
  when IO
    buf = ""
    io.read(length, buf)
  end
  new(buf)
end