Class: ActiveReporter::Serializer::HashTable
- Defined in:
- lib/active_reporter/serializer/hash_table.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 9 |
# File 'lib/active_reporter/serializer/hash_table.rb', line 4 def table fields = (report.grouper_names + report.all_aggregators.keys) titles = report.groupers.map(&method(:human_dimension_label)) + report.all_aggregators.collect { |k, v| human_aggregator_label({ k => v }) } [fields.zip(titles).to_h] + report.hashed_data.collect { |row| row.map { |k,v| [k, (v.respond_to?(:min) ? v.min : v).to_s] }.to_h} end |