Module: Que::View::ApplicationHelper

Defined in:
app/helpers/que/view/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#format_error(job) ⇒ Object



13
14
15
16
17
# File 'app/helpers/que/view/application_helper.rb', line 13

def format_error(job)
  return unless job[:last_error_message]

  job[:last_error_message].lines.first || ''
end

#humanized_enqueued_at(job) ⇒ Object



26
27
28
29
30
31
# File 'app/helpers/que/view/application_helper.rb', line 26

def humanized_enqueued_at(job)
  case job[:job_class]
  when 'ActiveJob::QueueAdapters::QueAdapter::JobWrapper'
    job.dig(:args, 0, :enqueued_at).to_time.strftime('%Y-%m-%d %H:%M:%S')
  end
end

#humanized_job_args(job) ⇒ Object



19
20
21
22
23
24
# File 'app/helpers/que/view/application_helper.rb', line 19

def humanized_job_args(job)
  case job[:job_class]
  when 'ActiveJob::QueueAdapters::QueAdapter::JobWrapper' then active_job_args(job)
  else que_args(job)
  end.join('<br />').html_safe
end

#humanized_job_class(job) ⇒ Object



6
7
8
9
10
11
# File 'app/helpers/que/view/application_helper.rb', line 6

def humanized_job_class(job)
  case job[:job_class]
  when 'ActiveJob::QueueAdapters::QueAdapter::JobWrapper' then job.dig(:args, 0, :job_class)
  else job[:job_class]
  end
end