class Blackbeard::MetricHour
Attributes
hour[R]
result[R]
Public Class Methods
new(time, result)
click to toggle source
# File lib/blackbeard/metric_hour.rb, line 5 def initialize(time, result) @hour = round_to_beginning_of_hour(time) @result = result end
Public Instance Methods
result_rows(segments)
click to toggle source
# File lib/blackbeard/metric_hour.rb, line 14 def result_rows(segments) [@hour.strftime("%l%P")] + results_for(segments) end
results_for(segments)
click to toggle source
# File lib/blackbeard/metric_hour.rb, line 10 def results_for(segments) segments.map{|s| result[s].to_f } end
Private Instance Methods
round_to_beginning_of_hour(t)
click to toggle source
# File lib/blackbeard/metric_hour.rb, line 20 def round_to_beginning_of_hour(t) t - ((t.min * 60) + t.sec) end