Sha256: 4092c2532ff3f12e4b145a89814143fdb3d36867a35cab6944e1c8341bc01e40

Contents?: true

Size: 363 Bytes

Versions: 3

Compression:

Stored size: 363 Bytes

Contents

# frozen_string_literal: true

module Wayfarer
  class Serializer < ActiveJob::Serializers::ObjectSerializer
    def serialize?(obj)
      obj.is_a?(Wayfarer::Task)
    end

    def serialize(task)
      super("url" => task.url, "batch" => task.batch)
    end

    def deserialize(hash)
      Wayfarer::Task.new(*hash.values_at("url", "batch"))
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wayfarer-0.4.7 lib/wayfarer/serializer.rb
wayfarer-0.4.6 lib/wayfarer/serializer.rb
wayfarer-0.4.5 lib/wayfarer/serializer.rb