Class: ActiveReporter::Serializer::Table

Inherits:
Base
  • Object
show all
Defined in:
lib/active_reporter/serializer/table.rb

Direct Known Subclasses

Csv, Highcharts

Instance Attribute Summary

Attributes inherited from Base

#report

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

#captionObject



18
19
20
# File 'lib/active_reporter/serializer/table.rb', line 18

def caption
  axis_summary
end

#each_rowObject



10
11
12
13
14
15
16
# File 'lib/active_reporter/serializer/table.rb', line 10

def each_row
  return to_enum(__method__) unless block_given?

  report.flat_data.each do |xes, y|
    yield report.groupers.zip(xes).map { |d, v| human_dimension_value_label(d, v) } + [human_aggregator_value_label(report.all_aggregators, y)]
  end
end

#headersObject



6
7
8
# File 'lib/active_reporter/serializer/table.rb', line 6

def headers
  report.groupers.map(&method(:human_dimension_label)) + [human_aggregator_label(report.all_aggregators)]
end