Class: Afterburn::ListIntervalSeries
- Inherits:
-
Object
- Object
- Afterburn::ListIntervalSeries
- Defined in:
- lib/afterburn/list_interval_series.rb
Instance Method Summary collapse
- #aggregate(lists, opts = {}) ⇒ Object
- #backlog_lists ⇒ Object
- #deployed_lists ⇒ Object
-
#initialize(lists, timestamps) ⇒ ListIntervalSeries
constructor
A new instance of ListIntervalSeries.
- #map(lists) ⇒ Object
-
#to_json ⇒ Object
deploy_list_counts + wip_list_counts + completed_list_counts.
- #wip_lists ⇒ Object
Constructor Details
#initialize(lists, timestamps) ⇒ ListIntervalSeries
Returns a new instance of ListIntervalSeries.
6 7 8 |
# File 'lib/afterburn/list_interval_series.rb', line 6 def initialize(lists, ) @lists, @timestamps = lists, end |
Instance Method Details
#aggregate(lists, opts = {}) ⇒ Object
17 18 19 20 |
# File 'lib/afterburn/list_interval_series.rb', line 17 def aggregate(lists, opts = {}) vectors = lists.map { |list| list.(@timestamps) } [{ "name" => opts[:name], "data" => vectors.inject(&:+).to_a }] end |
#backlog_lists ⇒ Object
28 29 30 |
# File 'lib/afterburn/list_interval_series.rb', line 28 def backlog_lists @lists.select { |list| list.role == List::Role::BACKLOG } end |
#deployed_lists ⇒ Object
36 37 38 |
# File 'lib/afterburn/list_interval_series.rb', line 36 def deployed_lists @lists.select { |list| list.role == List::Role::DEPLOYED } end |
#map(lists) ⇒ Object
22 23 24 25 26 |
# File 'lib/afterburn/list_interval_series.rb', line 22 def map(lists) lists.map do |list| { "name" => list.name, "data" => list.(@timestamps).to_a } end end |