Class: ActiveSupport::Messages::Codec
    Do not use.  This class is for internal use only.
  
| Relationships & Source Files | |
| Extension / Inclusion / Inheritance Descendants | |
| 
         Subclasses: 
        
       | 
    |
| Super Chains via Extension / Inclusion / Inheritance | |
| 
         Instance Chain: 
        
          self,
           
      Metadata
         | 
    |
| Inherits: | Object | 
| Defined in: | activesupport/lib/active_support/messages/codec.rb | 
Constant Summary
Metadata - Included
  
Class Attribute Summary
Class Method Summary
- .new(**options) ⇒ Codec constructor
 
Instance Attribute Summary
- #serializer readonly private
 - #use_message_serializer_for_metadata? ⇒ Boolean readonly private
 
Metadata - Included
Instance Method Summary
- #catch_and_ignore(throwable, &block) private
 - #catch_and_raise(throwable, as: nil, &block) private
 - #decode(encoded, url_safe: @url_safe) private
 - #deserialize(serialized) private
 - #encode(data, url_safe: @url_safe) private
 - #serialize(data) private
 
Metadata - Included
Constructor Details
    .new(**options)  ⇒ Codec 
  
# File 'activesupport/lib/active_support/messages/codec.rb', line 15
def initialize(**) @serializer = [:serializer] || self.class.default_serializer @serializer = SerializerWithFallback[@serializer] if @serializer.is_a?(Symbol) @url_safe = [:url_safe] @force_legacy_metadata_serializer = [:] end
Class Attribute Details
.default_serializer (rw)
[ GitHub ]# File 'activesupport/lib/active_support/messages/codec.rb', line 12
class_attribute :default_serializer, default: :marshal, instance_accessor: false, instance_predicate: false
Instance Attribute Details
#serializer (readonly, private)
[ GitHub ]# File 'activesupport/lib/active_support/messages/codec.rb', line 23
attr_reader :serializer
    #use_message_serializer_for_metadata?  ⇒ Boolean  (readonly, private)
  
  [ GitHub ]
# File 'activesupport/lib/active_support/messages/codec.rb', line 60
def !@force_legacy_metadata_serializer && super end
Instance Method Details
#catch_and_ignore(throwable, &block) (private)
[ GitHub ]# File 'activesupport/lib/active_support/messages/codec.rb', line 45
def catch_and_ignore(throwable, &block) catch throwable do return block.call end nil end
#catch_and_raise(throwable, as: nil, &block) (private)
[ GitHub ]# File 'activesupport/lib/active_support/messages/codec.rb', line 52
def catch_and_raise(throwable, as: nil, &block) error = catch throwable do return block.call end error = as.new(error.to_s) if as raise error end
#decode(encoded, url_safe: @url_safe) (private)
[ GitHub ]# File 'activesupport/lib/active_support/messages/codec.rb', line 29
def decode(encoded, url_safe: @url_safe) url_safe ? ::Base64.urlsafe_decode64(encoded) : ::Base64.strict_decode64(encoded) rescue StandardError => error throw :, error end
#deserialize(serialized) (private)
[ GitHub ]# File 'activesupport/lib/active_support/messages/codec.rb', line 39
def deserialize(serialized) serializer.load(serialized) rescue StandardError => error throw :, error end
#encode(data, url_safe: @url_safe) (private)
[ GitHub ]# File 'activesupport/lib/active_support/messages/codec.rb', line 25
def encode(data, url_safe: @url_safe) url_safe ? ::Base64.urlsafe_encode64(data, padding: false) : ::Base64.strict_encode64(data) end
#serialize(data) (private)
[ GitHub ]# File 'activesupport/lib/active_support/messages/codec.rb', line 35
def serialize(data) serializer.dump(data) end