Class: ActiveJob::Serializers::RangeSerializer

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

Constant Summary collapse

KEYS =
%w[begin end exclude_end].freeze

Instance Method Summary collapse

Methods inherited from ObjectSerializer

#serialize?

Instance Method Details

#deserialize(hash) ⇒ Object



13
14
15
# File 'lib/active_job/serializers/range_serializer.rb', line 13

def deserialize(hash)
  klass.new(*Arguments.deserialize(hash.values_at(*KEYS)))
end

#serialize(range) ⇒ Object



8
9
10
11
# File 'lib/active_job/serializers/range_serializer.rb', line 8

def serialize(range)
  args = Arguments.serialize([range.begin, range.end, range.exclude_end?])
  super(KEYS.zip(args).to_h)
end