123456789_123456789_123456789_123456789_123456789_

Class: ActiveJob::Serializers::ModuleSerializer

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: ActiveJob::Serializers::ObjectSerializer
Defined in: activejob/lib/active_job/serializers/module_serializer.rb

Instance Attribute Summary

ObjectSerializer - Inherited

#deserialize

Deserializes an argument from a JSON primitive type.

#serialize?

Determines if an argument should be serialized by a serializer.

::Singleton - Included

#duplicable?

::Singleton instances are not duplicable:

Instance Method Summary

ObjectSerializer - Inherited

#serialize

Serializes an argument to a JSON primitive type.

#klass

The class of the object that will be serialized.

Instance Method Details

#deserialize(hash)

[ GitHub ]

  
# File 'activejob/lib/active_job/serializers/module_serializer.rb', line 11

def deserialize(hash)
  hash["value"].constantize
end

#klass (private)

[ GitHub ]

  
# File 'activejob/lib/active_job/serializers/module_serializer.rb', line 16

def klass
  Module
end

#serialize(constant)

Raises:

[ GitHub ]

  
# File 'activejob/lib/active_job/serializers/module_serializer.rb', line 6

def serialize(constant)
  raise SerializationError, "Serializing an anonymous class is not supported" unless constant.name
  super("value" => constant.name)
end