class MessagePack::Factory::Pool
def dump(object)
def dump(object) @packers.with do |packer| packer.write(object) packer.full_pack end end
def initialize(factory, size, options = nil)
def initialize(factory, size, options = nil) options = nil if !options || options.empty? @factory = factory @packers = MemberPool.new(size) { factory.packer(options).freeze } @unpackers = MemberPool.new(size) { factory.unpacker(options).freeze } end
def load(data)
def load(data) @unpackers.with do |unpacker| unpacker.feed(data) unpacker.full_unpack end end
def packer(&block)
def packer(&block) @packers.with(&block) end
def unpacker(&block)
def unpacker(&block) @unpackers.with(&block) end