Class: AmqpUtils::Serialization

Inherits:
Object
  • Object
show all
Defined in:
lib/amqp_utils/serialization.rb

Defined Under Namespace

Classes: Base, Json, MsgPack

Class Method Summary collapse

Class Method Details

.deserialize(content_type, message) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/amqp_utils/serialization.rb', line 2

def self.deserialize(content_type, message)
  if serializer = serializers[content_type]
    serializer.deserialize(message) 
  else
    message
  end
end

.serialize(content_type, message) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/amqp_utils/serialization.rb', line 10

def self.serialize(content_type, message)
  if serializer = serializers[content_type]
    serializer.serialize(message) 
  else
    message
  end
end

.serializersObject



18
19
20
# File 'lib/amqp_utils/serialization.rb', line 18

def self.serializers
  @@serializers ||= {}
end