class ActiveJob::Serializers::DurationSerializer
:nodoc:
def deserialize(hash)
def deserialize(hash) value = hash["value"] parts = Arguments.deserialize(hash["parts"]) # `parts` is originally a hash, but will have been flattened to an array by Arguments.serialize klass.new(value, parts.to_h) end
def klass
def klass ActiveSupport::Duration end
def serialize(duration)
def serialize(duration) # Ideally duration.parts would be wrapped in an array before passing to Arguments.serialize, # but we continue passing the bare hash for backwards compatibility: super("value" => duration.value, "parts" => Arguments.serialize(duration.parts)) end