module SidekiqWebWorkers
Constants
- VERSION
Public Class Methods
config_path()
click to toggle source
# File lib/sidekiq-web-workers.rb, line 34 def self.config_path @config_root&.join("config", "sidekiq_web_jobs.yml") end
config_root=(path = Rails.root)
click to toggle source
# File lib/sidekiq-web-workers.rb, line 15 def self.config_root=(path = Rails.root) @config_root = path if path.is_a? Pathname @config_root = Pathname.new(path) end
jobs()
click to toggle source
# File lib/sidekiq-web-workers.rb, line 11 def self.jobs @jobs ||= load_jobs.uniq end
load_jobs()
click to toggle source
# File lib/sidekiq-web-workers.rb, line 20 def self.load_jobs if config_path.present? YAML.load_file(config_path) else [] end rescue Errno::ENOENT Sidekiq.logger.warn("YAML configuration file couldn't be found") [] rescue Psych::SyntaxError Sidekiq.logger.warn("YAML configuration file contains invalid syntax") [] end
search_jobs(search_text)
click to toggle source
# File lib/sidekiq-web-workers.rb, line 38 def self.search_jobs(search_text) job_names = SidekiqWebWorkers.jobs return job_names unless search_text.present? job_names.map{ |job_name| JobPresenter.new(job_name) } .delete_if(&:empty?) .find_all { |job| job.include?(search_text) } end