class ObjectSerializer
Ruby on Rails 7.2.3
Since v6.0.6Base 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
Inherits from
Includes
Methods (defined here)
- # deserialize
- # serialize
- # serialize?
Private methods (1)
Show private methods Implementation detail — not part of the public API.
- # klass
Used by
Subclasses (1)
Methods (inherited)
From Object
(17)
- # acts_like?
- # blank?
- # deep_dup
- # duplicable?
- # html_safe?
- # in?
- # instance_values
- # instance_variable_names
- # presence
- # presence_in
- # present?
- # to_param
- # to_query
- # try
- # try!
- # with
- # with_options
From Singleton
(1)
From ActiveSupport::NumericWithFormat
(2)
- # to_formatted_s
- # to_fs