Module: Blackbeard::DashboardHelpers
- Defined in:
- lib/blackbeard/dashboard_helpers.rb
Instance Method Summary collapse
- #js_date(date) ⇒ Object
- #js_hour(hour) ⇒ Object
- #js_metric_date(segments, d) ⇒ Object
- #js_metric_hour(segments, h) ⇒ Object
- #url(path = '') ⇒ Object
Instance Method Details
#js_date(date) ⇒ Object
7 8 9 |
# File 'lib/blackbeard/dashboard_helpers.rb', line 7 def js_date(date) "new Date(#{ date.year }, #{ date.month - 1}, #{ date.day } )" end |
#js_hour(hour) ⇒ Object
11 12 13 |
# File 'lib/blackbeard/dashboard_helpers.rb', line 11 def js_hour(hour) "new Date(#{ hour.year}, #{hour.month - 1 }, #{hour.day}, #{hour.hour})" end |
#js_metric_date(segments, d) ⇒ Object
15 16 17 18 19 |
# File 'lib/blackbeard/dashboard_helpers.rb', line 15 def js_metric_date(segments, d) row = [js_date(d.date)] segments.each{|s| row.push d.result[s].to_f } "[" + row.join(',') + "]" end |
#js_metric_hour(segments, h) ⇒ Object
21 22 23 24 25 |
# File 'lib/blackbeard/dashboard_helpers.rb', line 21 def js_metric_hour(segments, h) row = [js_hour(h.hour)] segments.each{|s| row.push h.result[s].to_f } "[" + row.join(',') + "]" end |
#url(path = '') ⇒ Object
3 4 5 |
# File 'lib/blackbeard/dashboard_helpers.rb', line 3 def url(path = '') env['SCRIPT_NAME'].to_s + '/' + path end |