Sha256: 097195d1136f3e84f78d66c623ab700aff38371fe8797cbd264cb2c2840f2326

Contents?: true

Size: 571 Bytes

Versions: 7

Compression:

Stored size: 571 Bytes

Contents

# frozen_string_literal: true

require 'msgpack'
require 'action_dispatch'

module Acfs
  module Middleware
    class MessagePack < Serializer
      unless defined?(::Mime::MSGPACK)
        ::Mime::Type.register 'application/x-msgpack', :msgpack
      end

      def mime
        ::Mime[:msgpack]
      end

      def encode(data)
        ::MessagePack.pack data
      end

      def decode(body)
        ::MessagePack.unpack body
      end
    end

    # @deprecated
    MessagePackEncoder = MessagePack

    # @deprecated
    MessagePackDecoder = MessagePack
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
acfs-2.0.0 lib/acfs/middleware/msgpack.rb
acfs-1.7.0 lib/acfs/middleware/msgpack.rb
acfs-1.6.0 lib/acfs/middleware/msgpack.rb
acfs-1.5.1 lib/acfs/middleware/msgpack.rb
acfs-1.5.0 lib/acfs/middleware/msgpack.rb
acfs-1.4.0 lib/acfs/middleware/msgpack.rb
acfs-1.3.4 lib/acfs/middleware/msgpack.rb