class ObjectSerializer
Ruby on Rails 6.1.7.10
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)
Implementation detail — not part of the public API.
- # klass
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!
- # unescape
- # with_options
From ActiveRecord::TestFixtures (4)
From ActiveSupport::Concern (3)
- # class_methods
- # included
- # prepended