Class: ActiveRecord::Encryption::MessagePackMessageSerializer
- Inherits:
-
Object
- Object
- ActiveRecord::Encryption::MessagePackMessageSerializer
- Defined in:
- lib/active_record/encryption/message_pack_message_serializer.rb
Overview
A message serializer that serializes Messages
with MessagePack.
The message is converted to a hash with this structure:
{
p: <payload>,
h: {
header1: value1,
header2: value2,
...
}
}
Then it is converted to the MessagePack format.
Instance Method Summary collapse
Instance Method Details
#binary? ⇒ Boolean
34 35 36 |
# File 'lib/active_record/encryption/message_pack_message_serializer.rb', line 34 def binary? true end |
#dump(message) ⇒ Object
22 23 24 25 |
# File 'lib/active_record/encryption/message_pack_message_serializer.rb', line 22 def dump() raise Errors::ForbiddenClass unless .is_a?(Message) ActiveSupport::MessagePack.dump(()) end |
#load(serialized_content) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/active_record/encryption/message_pack_message_serializer.rb', line 27 def load(serialized_content) data = ActiveSupport::MessagePack.load(serialized_content) (data, 1) rescue RuntimeError raise Errors::Decryption end |