Class: AcidicJob::Serializers::RecoveryPointSerializer

Inherits:
ActiveJob::Serializers::ObjectSerializer
  • Object
show all
Defined in:
lib/acidic_job/serializers/recovery_point_serializer.rb

Instance Method Summary collapse

Instance Method Details

#deserialize(hash) ⇒ Object



15
16
17
18
# File 'lib/acidic_job/serializers/recovery_point_serializer.rb', line 15

def deserialize(hash)
  recovery_point_class = hash["class"].constantize
  recovery_point_class.new(hash["name"])
end

#serialize(recovery_point) ⇒ Object



8
9
10
11
12
13
# File 'lib/acidic_job/serializers/recovery_point_serializer.rb', line 8

def serialize(recovery_point)
  super(
    "class" => recovery_point.class.name,
    "name" => recovery_point.name
  )
end

#serialize?(argument) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/acidic_job/serializers/recovery_point_serializer.rb', line 20

def serialize?(argument)
  defined?(::AcidicJob::RecoveryPoint) && argument.is_a?(::AcidicJob::RecoveryPoint)
end