class Delayed::Plugins::Reporting::PrettyJsonJobFormatter

Constants

INCLUDED_ATTRIBUTE_NAMES
INCLUDED_METHOD_NAMES

Attributes

included_attribute_names[R]
included_method_names[R]

Public Class Methods

new(attributes: INCLUDED_ATTRIBUTE_NAMES, methods: INCLUDED_METHOD_NAMES) click to toggle source
# File lib/delayed-plugins-reporting/pretty_json_job_formatter.rb, line 9
def initialize(attributes: INCLUDED_ATTRIBUTE_NAMES, methods: INCLUDED_METHOD_NAMES)
  @included_attribute_names = attributes
  @included_method_names = methods
end

Public Instance Methods

format(job) click to toggle source
# File lib/delayed-plugins-reporting/pretty_json_job_formatter.rb, line 14
def format(job)
  as_pretty_formatted_json(job)
end

Private Instance Methods

as_json(job) click to toggle source
# File lib/delayed-plugins-reporting/pretty_json_job_formatter.rb, line 20
def as_json(job)
  job.as_json(
    only: included_attribute_names,
    methods: included_method_names
  )
end
as_pretty_formatted_json(job) click to toggle source
# File lib/delayed-plugins-reporting/pretty_json_job_formatter.rb, line 27
def as_pretty_formatted_json(job)
  JSON.pretty_generate(as_json(job))
end