Module: SidekiqJobStats::Helpers::Stats
- Defined in:
- lib/sidekiq_job_stats/helpers/stats.rb
Instance Method Summary collapse
- #display_stat(stat, stat_name, format) ⇒ Object
- #mb_display(num) ⇒ Object
- #number_display(num) ⇒ Object
- #stat_header(stat_name) ⇒ Object
- #time_display(float) ⇒ Object
Instance Method Details
#display_stat(stat, stat_name, format) ⇒ Object
8 9 10 11 |
# File 'lib/sidekiq_job_stats/helpers/stats.rb', line 8 def display_stat(stat, stat_name, format) formatted_stat = self.send(format, stat.send(stat_name)) "<td>#{formatted_stat}</td>" end |
#mb_display(num) ⇒ Object
21 22 23 |
# File 'lib/sidekiq_job_stats/helpers/stats.rb', line 21 def mb_display(num) num.blank? ? "" : "#{num}MB" end |
#number_display(num) ⇒ Object
17 18 19 |
# File 'lib/sidekiq_job_stats/helpers/stats.rb', line 17 def number_display(num) num.blank? ? "" : num end |
#stat_header(stat_name) ⇒ Object
4 5 6 |
# File 'lib/sidekiq_job_stats/helpers/stats.rb', line 4 def stat_header(stat_name) "<th class='header'>" + stat_name.to_s.gsub(/_/,' ').capitalize + "</th>" end |
#time_display(float) ⇒ Object
13 14 15 |
# File 'lib/sidekiq_job_stats/helpers/stats.rb', line 13 def time_display(float) float.blank? ? "" : ("%.2f" % float.to_s) + "s" end |