class JobPresenter

Attributes

worker_name[R]

Public Class Methods

new(job_name) click to toggle source
# File lib/sidekiq-web-workers/job_presenter.rb, line 4
def initialize(job_name)
  @worker_name = job_name
end

Public Instance Methods

description() click to toggle source
# File lib/sidekiq-web-workers/job_presenter.rb, line 8
def description
  job_constantized.respond_to?(:description) ? job_constantized.description : ""
end
empty?() click to toggle source
# File lib/sidekiq-web-workers/job_presenter.rb, line 27
def empty?
  job_constantized.blank?
end
escaped_name() click to toggle source
# File lib/sidekiq-web-workers/job_presenter.rb, line 31
def escaped_name
  CGI.escape worker_name
end
include?(text) click to toggle source
# File lib/sidekiq-web-workers/job_presenter.rb, line 35
def include?(text)
  return false unless job_constantized
  downcased_text = text.downcase
  worker_name.downcase.include?(downcased_text) ||
    description.downcase.include?(downcased_text)
end
job_constantized() click to toggle source
# File lib/sidekiq-web-workers/job_presenter.rb, line 21
def job_constantized
  @worker_name.constantize
rescue
  nil
end
method_arguments() click to toggle source
# File lib/sidekiq-web-workers/job_presenter.rb, line 12
def method_arguments
  return [] unless job_constantized
  job_constantized.new.method(:perform).parameters
  #[[:opt, :param_name], [:req, :param_name]] empty if no params
  # for named parameters this can be [[:key, :param_name], [:keyreq, :param_name]]
  # key means optional keyreq means required but sidekiq does not s
  # sidekiq doesn't support named args tho https://github.com/mperham/sidekiq/issues/2372
end