Class: Blackbeard::MetricHour
- Inherits:
-
Object
- Object
- Blackbeard::MetricHour
- Defined in:
- lib/blackbeard/metric_hour.rb
Instance Attribute Summary collapse
-
#hour ⇒ Object
readonly
Returns the value of attribute hour.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
-
#initialize(time, result) ⇒ MetricHour
constructor
A new instance of MetricHour.
- #result_rows(segments) ⇒ Object
- #results_for(segments) ⇒ Object
Constructor Details
#initialize(time, result) ⇒ MetricHour
Returns a new instance of MetricHour.
5 6 7 8 |
# File 'lib/blackbeard/metric_hour.rb', line 5 def initialize(time, result) @hour = round_to_beginning_of_hour(time) @result = result end |
Instance Attribute Details
#hour ⇒ Object (readonly)
Returns the value of attribute hour.
3 4 5 |
# File 'lib/blackbeard/metric_hour.rb', line 3 def hour @hour end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
3 4 5 |
# File 'lib/blackbeard/metric_hour.rb', line 3 def result @result end |
Instance Method Details
#result_rows(segments) ⇒ Object
14 15 16 |
# File 'lib/blackbeard/metric_hour.rb', line 14 def result_rows(segments) [@hour.strftime("%l%P")] + results_for(segments) end |
#results_for(segments) ⇒ Object
10 11 12 |
# File 'lib/blackbeard/metric_hour.rb', line 10 def results_for(segments) segments.map{|s| result[s].to_f } end |