Class: Memory::Wrapper

Inherits:
MessagePack::Factory
  • Object
show all
Defined in:
lib/memory/sampler.rb

Instance Method Summary collapse

Constructor Details

#initialize(cache) ⇒ Wrapper

Returns a new instance of Wrapper.



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/memory/sampler.rb', line 22

def initialize(cache)
  super()
  
  @cache = cache
  
  self.register_type(0x01, Allocation,
    packer: ->(instance){self.pack(instance.pack)},
    unpacker: ->(data){Allocation.unpack(@cache, self.unpack(data))},
  )
  
  self.register_type(0x02, Symbol)
end