diff --git a/lib/cborio.rb b/lib/cborio.rb index 0354c4f..7eb5402 100644 --- a/lib/cborio.rb +++ b/lib/cborio.rb @@ -1,54 +1,89 @@ +# vim: set noet sw=2 ts=2 sts=2: + require 'cbor' +require 'socket' -class CBORIO - include Enumerable - def orig_io() @io end - def unpacker() @un end - def close() @io.close end - def write( obj) @io.write CBOR.pack( obj) end - def sync() @io.sync end - def sync( v) @io.sync = v end - def self.pipe() IO.pipe.map &self.method(:new) end - def self.popen &exe - rd, wr = self.pipe - pid = - fork do - rd.close - yield wr - exit 0 - end - wr.close - [pid, rd] - end +class CBORIO " end - def initialize io - @io, @un = io, CBOR::Unpacker.new - @io.sync = true - end + class <" end + def initialize( io) @io = io end + + class <