Module: Kobako::Wire::Codec::Factory
- Defined in:
- lib/kobako/wire/codec/factory.rb
Overview
Cached MessagePack::Factory that owns the kobako wire ext-type registration (SPEC.md → Wire Codec → Ext Types).
The factory is the single place in the host gem that touches msgpack API — both Encoder and Decoder delegate through it, so the three kobako ext codes (0x00 Symbol, 0x01 Capability Handle, 0x02 Exception envelope) are configured exactly once at module load.
Class Method Summary collapse
-
.build ⇒ Object
Build a fresh factory.
-
.instance ⇒ Object
Returns the lazily-built process-wide
MessagePack::Factory.
Class Method Details
.build ⇒ Object
Build a fresh factory. Exposed for tests that need an isolated instance; production code should call instance.
41 42 43 44 45 46 47 |
# File 'lib/kobako/wire/codec/factory.rb', line 41 def self.build factory = MessagePack::Factory.new register_symbol_type(factory) register_handle_type(factory) register_exception_type(factory) factory end |
.instance ⇒ Object
Returns the lazily-built process-wide MessagePack::Factory.
35 36 37 |
# File 'lib/kobako/wire/codec/factory.rb', line 35 def self.instance @instance ||= build end |