Module: Von

Defined in:
lib/von/dashboard.rb,
lib/von/dashboard/web.rb,
lib/von/dashboard/web.rb,
lib/von/dashboard/version.rb

Defined Under Namespace

Modules: Dashboard

Class Method Summary collapse

Class Method Details

.to_rickshaw(counter, period) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/von/dashboard/web.rb', line 21

def to_rickshaw counter, period
  r1 = self.count(counter).per period
  r2 = r1.map { |h|
    d = h[:timestamp]
    d += "-01" if period == :month
    d = Time.parse d
    c = h[:count]
    { x:d.to_i, y:c}
  }
  r2.to_json
end