Class: Report::Summary
- Inherits:
-
Object
- Object
- Report::Summary
- Defined in:
- lib/pagerduty_tools/report.rb
Instance Attribute Summary collapse
-
#current_end ⇒ Object
Returns the value of attribute current_end.
-
#current_start ⇒ Object
Returns the value of attribute current_start.
-
#previous_end ⇒ Object
Returns the value of attribute previous_end.
-
#previous_start ⇒ Object
Returns the value of attribute previous_start.
Instance Method Summary collapse
- #<<(item) ⇒ Object
- #current_count(&selector) ⇒ Object
- #current_items ⇒ Object
- #current_summary(&selector) ⇒ Object
-
#initialize(current_start, current_end, previous_start, previous_end) ⇒ Summary
constructor
A new instance of Summary.
- #pct_change(&selector) ⇒ Object
- #previous_count(&selector) ⇒ Object
- #previous_items ⇒ Object
- #previous_summary(&selector) ⇒ Object
Constructor Details
#initialize(current_start, current_end, previous_start, previous_end) ⇒ Summary
Returns a new instance of Summary.
45 46 47 48 49 50 51 |
# File 'lib/pagerduty_tools/report.rb', line 45 def initialize(current_start, current_end, previous_start, previous_end) @current_start = current_start @current_end = current_end @previous_start = previous_start @previous_end = previous_end @items = [] end |
Instance Attribute Details
#current_end ⇒ Object
Returns the value of attribute current_end.
43 44 45 |
# File 'lib/pagerduty_tools/report.rb', line 43 def current_end @current_end end |
#current_start ⇒ Object
Returns the value of attribute current_start.
43 44 45 |
# File 'lib/pagerduty_tools/report.rb', line 43 def current_start @current_start end |
#previous_end ⇒ Object
Returns the value of attribute previous_end.
43 44 45 |
# File 'lib/pagerduty_tools/report.rb', line 43 def previous_end @previous_end end |
#previous_start ⇒ Object
Returns the value of attribute previous_start.
43 44 45 |
# File 'lib/pagerduty_tools/report.rb', line 43 def previous_start @previous_start end |
Instance Method Details
#<<(item) ⇒ Object
53 54 55 |
# File 'lib/pagerduty_tools/report.rb', line 53 def <<(item) @items << item end |
#current_count(&selector) ⇒ Object
65 66 67 |
# File 'lib/pagerduty_tools/report.rb', line 65 def current_count(&selector) count_from(current_items, &selector) end |
#current_items ⇒ Object
57 58 59 |
# File 'lib/pagerduty_tools/report.rb', line 57 def current_items select_between?(current_start, current_end) end |
#current_summary(&selector) ⇒ Object
73 74 75 |
# File 'lib/pagerduty_tools/report.rb', line 73 def current_summary(&selector) summarize(current_items, &selector) end |
#pct_change(&selector) ⇒ Object
81 82 83 84 85 |
# File 'lib/pagerduty_tools/report.rb', line 81 def pct_change(&selector) old_value = previous_count(&selector) new_value = current_count(&selector) Report.pct_change old_value, new_value end |
#previous_count(&selector) ⇒ Object
69 70 71 |
# File 'lib/pagerduty_tools/report.rb', line 69 def previous_count(&selector) count_from(previous_items, &selector) end |
#previous_items ⇒ Object
61 62 63 |
# File 'lib/pagerduty_tools/report.rb', line 61 def previous_items select_between?(previous_start, previous_end) end |
#previous_summary(&selector) ⇒ Object
77 78 79 |
# File 'lib/pagerduty_tools/report.rb', line 77 def previous_summary(&selector) summarize(previous_items, &selector) end |