aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/lib/active_job/serializers/date_serializer.rb
blob: 3ec587bc54ededb17208282a09735f8c985a3687 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

module ActiveJob
  module Serializers
    class DateSerializer < ObjectSerializer # :nodoc:
      def serialize(date)
        super("value" => date.iso8601)
      end

      def deserialize(hash)
        Date.iso8601(hash["value"])
      end

      private
        def klass
          Date
        end
    end
  end
end