class Async::Container::Channel
Provides a basic multi-thread/multi-process uni-directional communication channel.
def close
def close close_read close_write end
def close_read
def close_read @in.close end
def close_write
def close_write @out.close end
def initialize
def initialize @in, @out = ::IO.pipe end
def receive
Internally, prefers to receive newline formatted JSON, otherwise returns a hash table with a single key `:line` which contains the line of data that could not be parsed as JSON.
Receive an object from the pipe.
def receive if data = @in.gets begin return JSON.parse(data, symbolize_names: true) rescue return {line: data} end end end