Class: AcidicJob::Serializers::RangeSerializer

Inherits:
ActiveJob::Serializers::ObjectSerializer
  • Object
show all
Defined in:
lib/acidic_job/serializers/range_serializer.rb

Constant Summary collapse

KEYS =
%w[begin end exclude_end].freeze

Instance Method Summary collapse

Instance Method Details

#deserialize(hash) ⇒ Object



16
17
18
# File 'lib/acidic_job/serializers/range_serializer.rb', line 16

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

#serialize(range) ⇒ Object



11
12
13
14
# File 'lib/acidic_job/serializers/range_serializer.rb', line 11

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