Class: Yes::Core::ActiveJobSerializers::CommandGroupSerializer
- Inherits:
-
ActiveJob::Serializers::ObjectSerializer
- Object
- ActiveJob::Serializers::ObjectSerializer
- Yes::Core::ActiveJobSerializers::CommandGroupSerializer
- Defined in:
- lib/yes/core/active_job_serializers/command_group_serializer.rb
Overview
ActiveJob serializer for CommandGroup objects.
Instance Method Summary collapse
-
#deserialize(hash) ⇒ Yes::Core::Commands::Group
The deserialized command group.
-
#serialize(command_group) ⇒ Hash
The serialized representation.
-
#serialize?(argument) ⇒ Boolean
True if the argument can be serialized.
Instance Method Details
#deserialize(hash) ⇒ Yes::Core::Commands::Group
Returns the deserialized command group.
22 23 24 25 |
# File 'lib/yes/core/active_job_serializers/command_group_serializer.rb', line 22 def deserialize(hash) symbolized_hash = hash.deep_symbolize_keys Object.const_get(symbolized_hash[:_type]).new(symbolized_hash.except(:_aj_serialized, :_type)) end |
#serialize(command_group) ⇒ Hash
Returns the serialized representation.
16 17 18 |
# File 'lib/yes/core/active_job_serializers/command_group_serializer.rb', line 16 def serialize(command_group) super(command_group.to_h.merge(_type: command_group.class.name)) end |