aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/lib/active_job/serializers/date_serializer.rb
blob: e995d30faaafb131f68e6eea26320afb56abecc1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 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