Class: DeepConnect::XIO
Instance Attribute Summary collapse
-
#io ⇒ Object
readonly
Returns the value of attribute io.
Instance Method Summary collapse
-
#initialize(io) ⇒ XIO
constructor
A new instance of XIO.
- #write(str) ⇒ Object
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
#io ⇒ Object (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 |