Class: Stenotype::ContextHandlers::Rails::ActiveJob

Inherits:
Base
  • Object
show all
Defined in:
lib/stenotype/context_handlers/rails/active_job.rb

Overview

ActiveJob handler to support fetching data out of an ActiveJob instance

Instance Attribute Summary

Attributes inherited from Base

#context, #options

Instance Method Summary collapse

Methods inherited from Base

inherited, #initialize

Constructor Details

This class inherits a constructor from Stenotype::ContextHandlers::Base

Instance Method Details

#as_json(*_args) ⇒ Hash

TODO:

How to deal with _args? It won't necessarily respond to #as_json

Returns a JSON representation of job's data.

Returns:

  • (Hash)

    a JSON representation of job's data



22
23
24
25
26
27
28
29
# File 'lib/stenotype/context_handlers/rails/active_job.rb', line 22

def as_json(*_args)
  {
    job_id: job_id,
    enqueued_at: Time.now.utc,
    queue_name: queue_name,
    class: context.class.name,
  }
end