class Resque::Plugins::JobStats::Statistic

A class composed of a job class and the various job statistics collected for the given job.

Constants

DEFAULT_STATS

An array of the default statistics that will be displayed in the web tab

Public Class Methods

find_all(metrics) click to toggle source

Find and load a Statistic for all resque jobs that are in the Resque::Plugins::JobStats.measured_jobs collection

# File lib/resque/plugins/job_stats/statistic.rb, line 16
def find_all(metrics)
  Resque::Plugins::JobStats.measured_jobs.map{|j| new(j, metrics)}
end
new(job_class, metrics) click to toggle source

A series of metrics describing one job class.

# File lib/resque/plugins/job_stats/statistic.rb, line 22
def initialize(job_class, metrics)
  self.job_class = job_class
  self.load(metrics)
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/resque/plugins/job_stats/statistic.rb, line 37
def <=>(other)
  self.name <=> other.name
end
load(metrics) click to toggle source
# File lib/resque/plugins/job_stats/statistic.rb, line 27
def load(metrics)
  metrics.each do |metric|
    self.send("#{metric}=", job_class.send(metric))
  end
end
name() click to toggle source
# File lib/resque/plugins/job_stats/statistic.rb, line 33
def name
  self.job_class.name
end