Class: Paquito::CodecFactory
- Inherits:
-
Object
- Object
- Paquito::CodecFactory
- Defined in:
- lib/paquito/codec_factory.rb
Defined Under Namespace
Classes: MessagePackCodec
Class Method Summary collapse
Class Method Details
.build(types = [], freeze: false, serializable_type: false, pool: 1, format_version: Paquito.format_version) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/paquito/codec_factory.rb', line 8 def self.build(types = [], freeze: false, serializable_type: false, pool: 1, format_version: Paquito.format_version) factory = if types.empty? && !serializable_type MessagePack::DefaultFactory else MessagePack::Factory.new end Types.register(factory, types, format_version: format_version) unless types.empty? Types.register_serializable_type(factory) if serializable_type if pool && pool > 0 && factory.respond_to?(:pool) factory = factory.freeze.pool(pool, freeze: freeze) freeze = false end MessagePackCodec.new(factory, freeze: freeze) end |