Class: ActiveJob::Serializers::DurationSerializer

Inherits:
ObjectSerializer show all
Defined in:
lib/active_job/serializers/duration_serializer.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from ObjectSerializer

#serialize?

Instance Method Details

#deserialize(hash) ⇒ Object



10
11
12
13
14
15
# File 'lib/active_job/serializers/duration_serializer.rb', line 10

def deserialize(hash)
  value = hash["value"]
  parts = Arguments.deserialize(hash["parts"])

  klass.new(value, parts)
end

#serialize(duration) ⇒ Object



6
7
8
# File 'lib/active_job/serializers/duration_serializer.rb', line 6

def serialize(duration)
  super("value" => duration.value, "parts" => Arguments.serialize(duration.parts))
end