Module: RuportReportBuilder::InstanceMethods

Defined in:
lib/ruport_report_builder.rb

Instance Method Summary collapse

Instance Method Details

#build_reportObject Also known as: build

Returns a Ruport table object you can then call methods on



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/ruport_report_builder.rb', line 84

def build_report
  main_report, *appended_reports = self.class.report_names

  table_data = generate_report_data(main_report)

  return Ruport::Data::Table.new if table_data.empty?

  # build the table and set the column names based on the data from the "Primary" report
  table = Ruport::Data::Table.new(:column_names => table_data.first.keys, :data => table_data.map{|d| d.values})


  appended_reports.each do |rpt|
    addl_rpt_data = generate_report_data(rpt)
    addl_rpt_data.each{|row| table << row}
  end
  do_sort(table)
end