module Resque::Plugins::JobStats::Server::Helpers

Public Instance Methods

check_or_cross_stat(value) click to toggle source
# File lib/resque-job-stats/server.rb, line 48
def check_or_cross_stat(value)
  value ? "✓" : "✗"
end
display_stat(stat, stat_name, format) click to toggle source
# File lib/resque-job-stats/server.rb, line 41
def display_stat(stat, stat_name, format)
  if(display_stat?(stat_name))
    formatted_stat = self.send(format, stat.send(stat_name))
    "<td>#{formatted_stat}</td>"
  end
end
display_stat?(stat_name) click to toggle source
# File lib/resque-job-stats/server.rb, line 22
def display_stat?(stat_name)
  self.class.job_stats_to_display == :all ||
    [self.class.job_stats_to_display].flatten.map(&:to_sym).include?(stat_name.to_sym)
end
number_display(num) click to toggle source
# File lib/resque-job-stats/server.rb, line 31
def number_display(num)
  num.zero? ? "" : num
end
stat_header(stat_name) click to toggle source
# File lib/resque-job-stats/server.rb, line 35
def stat_header(stat_name)
  if(display_stat?(stat_name))
    "<th>" + stat_name.to_s.gsub(/_/,' ').capitalize + "</th>"
  end
end
time_display(float) click to toggle source
# File lib/resque-job-stats/server.rb, line 27
def time_display(float)
  float.zero? ? "" : ("%.2f" % float.to_s) + "s"
end