From b098584f63521d214c1107e6eaa24f292b8e4df8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Fri, 9 Feb 2018 15:45:11 -0500 Subject: Add symbol and duration serializers --- .../lib/active_job/serializers/symbol_serializer.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 activejob/lib/active_job/serializers/symbol_serializer.rb (limited to 'activejob/lib/active_job/serializers/symbol_serializer.rb') diff --git a/activejob/lib/active_job/serializers/symbol_serializer.rb b/activejob/lib/active_job/serializers/symbol_serializer.rb new file mode 100644 index 0000000000..ec27f6828a --- /dev/null +++ b/activejob/lib/active_job/serializers/symbol_serializer.rb @@ -0,0 +1,21 @@ +module ActiveJob + module Serializers + class SymbolSerializer < ObjectSerializer + class << self + def serialize(argument) + super("value" => argument.to_s) + end + + def deserialize(argument) + argument["value"].to_sym + end + + private + + def klass + Symbol + end + end + end + end +end -- cgit v1.2.3