Class: AcidicJob::Serializers::ActiveKiqSerializer

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

Instance Method Summary collapse

Instance Method Details

#deserialize(hash) ⇒ Object



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

def deserialize(hash)
  worker_class = hash["job_class"].constantize
  worker_class.new(*hash["arguments"])
end

#serialize(worker) ⇒ Object



8
9
10
11
12
13
# File 'lib/acidic_job/serializers/active_kiq_serializer.rb', line 8

def serialize(worker)
  super(
    "job_class" => worker.class.name,
    "arguments" => Arguments.serialize(worker.arguments),
  )
end

#serialize?(argument) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/acidic_job/serializers/active_kiq_serializer.rb', line 20

def serialize?(argument)
  defined?(::AcidicJob::ActiveKiq) && argument.class < ::AcidicJob::ActiveKiq
end