Module: ActiveReporter::Report::Aggregation
- Included in:
- ActiveReporter::Report
- Defined in:
- lib/active_reporter/report/aggregation.rb
Instance Method Summary collapse
-
#flat_data ⇒ Object
flat hash of { [x1, x2, x3] => y }.
- #hashed_data ⇒ Object
-
#nested_data ⇒ Object
(also: #data)
nested array of [{ key: x3, values: [{ key: x2, values: [{ key: x1, value: y }] }] }].
- #raw_data ⇒ Object
- #source_data ⇒ Object
- #total_data ⇒ Object (also: #totals)
Instance Method Details
#flat_data ⇒ Object
flat hash of { [x1, x2, x3] => y }
12 13 14 |
# File 'lib/active_reporter/report/aggregation.rb', line 12 def flat_data @flat_data ||= flatten_data end |
#hashed_data ⇒ Object
16 17 18 |
# File 'lib/active_reporter/report/aggregation.rb', line 16 def hashed_data @hashed_data ||= hash_data end |
#nested_data ⇒ Object Also known as: data
nested array of
- { key: x3, values: [{ key: x2, values: [{ key: x1, value: y }
-
}] }]
22 23 24 |
# File 'lib/active_reporter/report/aggregation.rb', line 22 def nested_data @nested_data ||= nest_data end |
#raw_data ⇒ Object
6 7 8 |
# File 'lib/active_reporter/report/aggregation.rb', line 6 def raw_data @raw_data ||= aggregate end |
#source_data ⇒ Object
32 33 34 35 36 |
# File 'lib/active_reporter/report/aggregation.rb', line 32 def source_data @source_data ||= aggregators.values.reduce(groups) do |relation, aggregator| relation.merge(aggregator.aggregate(base_relation)) end end |
#total_data ⇒ Object Also known as: totals
27 28 29 |
# File 'lib/active_reporter/report/aggregation.rb', line 27 def total_data @total_data ||= total end |