Module: ActiveResource::Formats::MsgpackFormat

Extended by:
MsgpackFormat
Included in:
MsgpackFormat
Defined in:
lib/msgpack_rails/3/activeresource_formats/msgpack_format.rb

Instance Method Summary collapse

Instance Method Details

#decode(mpac) ⇒ Object



20
21
22
# File 'lib/msgpack_rails/3/activeresource_formats/msgpack_format.rb', line 20

def decode(mpac)
  MessagePack.unpack(mpac)
end

#encode(hash, options = nil) ⇒ Object

Options hash currently serves no function. TODO: Fix it, duh. Just like the Serializer’s issue



16
17
18
# File 'lib/msgpack_rails/3/activeresource_formats/msgpack_format.rb', line 16

def encode(hash, options = nil)
  hash.to_msgpack
end

#extensionObject



6
7
8
# File 'lib/msgpack_rails/3/activeresource_formats/msgpack_format.rb', line 6

def extension
  "mpac"
end

#mime_typeObject



10
11
12
# File 'lib/msgpack_rails/3/activeresource_formats/msgpack_format.rb', line 10

def mime_type
  Mime::MPAC.to_s
end