lib/rack/session/smart_cookie.rb in rack-session-smart_cookie-0.1.1 vs lib/rack/session/smart_cookie.rb in rack-session-smart_cookie-0.1.2
- old
+ new
@@ -53,13 +53,15 @@
def initialize
# Create our own factory so we don't pollute the global namespace
# with our custom type.
@factory = ::MessagePack::Factory.new
- # user gets 0x00...0x60
+
+ # MessagePack gets custom types 0x80..0xFF
# we get 0x60...0x80
- # MessagePack gets 0x80..0xFF
@factory.register_type(0x60, Symbol)
+ # user gets 0x00...0x60
+ yield @factory if block_given?
end
def encode(data)
# https://github.com/msgpack/msgpack-ruby/issues/141
factory.packer.write(data).to_str