Sha256: 58f6ef8ca6a2c71e99e538342a89ff33a6acd3d9765d354d7a8928f39b7dca36
Contents?: true
Size: 794 Bytes
Versions: 3
Compression:
Stored size: 794 Bytes
Contents
require "neovim/logging" require "msgpack" module Neovim class EventLoop # Handles serializing RPC messages to and from MessagePack # # @api private class Serializer include Logging def initialize(unpacker = MessagePack::Unpacker.new) @unpacker = unpacker end # Serialize an RPC message def write(obj) log(:debug) { {:object => obj} } yield MessagePack.pack(obj) end def read(bytes) @unpacker.feed_each(bytes) do |obj| log(:debug) { {:object => obj} } yield obj end end def register_type(id, &block) @unpacker.register_type(id) do |data| index = MessagePack.unpack(data) block.call(index) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
neovim-0.6.2 | lib/neovim/event_loop/serializer.rb |
neovim-0.6.1 | lib/neovim/event_loop/serializer.rb |
neovim-0.6.0 | lib/neovim/event_loop/serializer.rb |