class Sanford::IOPipe
Constants
- NULL
- NUMBER_OF_BYTES
Attributes
reader[R]
writer[R]
Public Class Methods
new()
click to toggle source
# File lib/sanford/io_pipe.rb, line 10 def initialize @reader = NULL @writer = NULL end
Public Instance Methods
read()
click to toggle source
# File lib/sanford/io_pipe.rb, line 26 def read @reader.read_nonblock(NUMBER_OF_BYTES) end
setup()
click to toggle source
# File lib/sanford/io_pipe.rb, line 15 def setup @reader, @writer = ::IO.pipe end
teardown()
click to toggle source
# File lib/sanford/io_pipe.rb, line 19 def teardown @reader.close unless @reader === NULL @writer.close unless @writer === NULL @reader = NULL @writer = NULL end
wait(timeout = nil)
click to toggle source
# File lib/sanford/io_pipe.rb, line 34 def wait(timeout = nil) !!::IO.select([@reader], nil, nil, timeout) end
write(value)
click to toggle source
# File lib/sanford/io_pipe.rb, line 30 def write(value) @writer.write_nonblock(value[0, NUMBER_OF_BYTES]) end