Class: ActiveSupport::Messages::Codec

Inherits:
Object
  • Object
show all
Includes:
Metadata
Defined in:
activesupport/lib/active_support/messages/codec.rb

Overview

:nodoc:

Constant Summary

Constants included from Metadata

Metadata::ENVELOPE_SERIALIZERS

Instance Attribute Summary

Attributes included from Metadata

#use_message_serializer_for_metadata

Instance Method Summary collapse

Constructor Details

#initialize(serializer:, url_safe:) ⇒ Codec

Returns a new instance of Codec.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'activesupport/lib/active_support/messages/codec.rb', line 10

def initialize(serializer:, url_safe:)
  @serializer =
    case serializer
    when :marshal
      Marshal
    when :hybrid
      JsonWithMarshalFallback
    when :json
      JSON
    else
      serializer
    end

  @url_safe = url_safe
end