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



16
17
18
# File 'lib/active_reporter/serializer/table.rb', line 16

def caption
  axis_summary
end

#each_rowObject



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

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



4
5
6
# File 'lib/active_reporter/serializer/table.rb', line 4

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