Class: ActiveReporter::Serializer::NestedHash
- Defined in:
- lib/active_reporter/serializer/nested_hash.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#axis_summary, #filter_summary, #human_aggregator_label, #human_aggregator_value_label, #human_category_value_label, #human_dimension_label, #human_dimension_value_label, #human_null_value_label, #human_number_value_label, #human_time_value_label, #initialize, #record_type, #time_formats
Constructor Details
This class inherits a constructor from ActiveReporter::Serializer::Base
Instance Method Details
#table ⇒ Object
4 5 6 7 8 |
# File 'lib/active_reporter/serializer/nested_hash.rb', line 4 def table report.hashed_data.collect { |row| row.map { |k,v| [k, (v.respond_to?(:min) ? v.min : v).to_s] }.to_h }.collect do |row| report.grouper_names.reverse.inject(row.slice(*report.all_aggregators.keys)) { |nested_row_data, group| { row[group] => nested_row_data } } end.reduce({}, :deep_merge) end |