lib/rubypivot/pivot.rb
# return an pivot array with titles
return an pivot array with titles
return an pivot array with titles
def build
      parse_data unless @rows_parsed
      res = []
      res << header_row if @options[:header]
      @row_titles.each do |row_title|
        row = @rows_parsed.get_row(row_title)
        data_array = []
        data_array << column_head(row_title) if @options[:row_header] 
        data_array += row.to_a(column_titles)
        data_array << row.total(column_titles) if @options[:row_total]
        res << data_array
      end
      res
    end
def build parse_data unless @rows_parsed res = [ ] res << header_row if @options [ :header ] @row_titles . each do | row_title | row = @rows_parsed . get_row ( row_title ) data_array = [ ] data_array << column_head ( row_title ) if @options [ :row_header ] data_array += row . to_a ( column_titles ) data_array << row . total ( column_titles ) if @options [ :row_total ] res << data_array end res end
return an pivot array with titles
return an pivot array with titles