Base
class for serializing and deserializing custom objects.
Example:
class MoneySerializer < ActiveJob::Serializers::ObjectSerializer
def serialize(money)
super("amount" => money.amount, "currency" => money.currency)
end
def deserialize(hash)
Money.new(hash["amount"], hash["currency"])
end
private
def klass
Money
end
end
Methods
- D
- K
- S
Included Modules
Instance Public methods
deserialize(json) Link
Deserializes an argument from a JSON primitive type.
serialize(hash) Link
Serializes an argument to a JSON primitive type.
serialize?(argument) Link
Determines if an argument should be serialized by a serializer.