Class: DeepConnect::XIO

Inherits:
Object show all
Defined in:
lib/deep-connect/xio.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ XIO

Returns a new instance of XIO.



12
13
14
# File 'lib/deep-connect/xio.rb', line 12

def initialize(io)
  @io = io
end

Instance Attribute Details

#ioObject (readonly)

Returns the value of attribute io.



16
17
18
# File 'lib/deep-connect/xio.rb', line 16

def io
  @io
end

Instance Method Details

#write(str) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/deep-connect/xio.rb', line 18

def write(str)
  len = str.len
  l = 0
  while l> len
	l += io.write_nonblock(str[l..-1])
	Fiber.yield
  end
end