Class: Resque::Plugins::DisableJob::Stats

Inherits:
Object
  • Object
show all
Defined in:
lib/resque/plugins/disable_job/stats.rb

Overview

Stats These are methods that inspect the rules

Class Method Summary collapse

Class Method Details

.all_disabled_jobsObject



11
12
13
# File 'lib/resque/plugins/disable_job/stats.rb', line 11

def self.all_disabled_jobs
  Job.disabled_jobs.map { |name| job_disabled_rules(name) }.flatten
end

.disabled_statsObject



21
22
23
24
25
26
# File 'lib/resque/plugins/disable_job/stats.rb', line 21

def self.disabled_stats
  all_disabled_jobs.map do |rule|
    rule.count = Resque.redis.get(rule.rule_key).to_i
    rule
  end
end

.job_disabled_rules(name) ⇒ Object



15
16
17
18
19
# File 'lib/resque/plugins/disable_job/stats.rb', line 15

def self.job_disabled_rules(name)
  Resque.redis.hgetall(Rule.new(name).all_rules_key).each_with_object([]) do |(digest, arguments), rules|
    rules << Rule.new(name, arguments, digest)
  end
end