<commit_before>#------------------------------------------------------------------------------
#
# TemplateBuilder
#
# Base class for template builders
#
#------------------------------------------------------------------------------
class TemplateBuilder

  attr_accessor :organization
  attr_accessor :asset_types

  def build

    # Create a new workbook
    p = Axlsx::Package.new
    wb = p.workbook

    # Call back to setup any implementation specific options needed
    setup_workbook(wb)
    
    # Add the worksheet
    sheet = wb.add_worksheet(:name => worksheet_name)

    # setup any styles and cache them for later
    style_cache = {}
    styles.each do |s|
      Rails.logger.debug s.inspect
      style = wb.styles.add_style(s)
      Rails.logger.debug style.inspect
      style_cache[s[:name]] = style
    end
    Rails.logger.debug style_cache.inspect

    # Add the header rows
    header_rows.each do |header_row|
      sheet.add_row header_row
    end

    # add the rows
    add_rows(sheet)

    # Add the column styles
    column_styles.each do |col_style|
      Rails.logger.debug col_style.inspect
      sheet.col_style col_style[:column], style_cache[col_style[:name]]
    end

    # Perform any additional processing<commit_msg>Change oreder in which the sheets are created so the first sheet is always the main sheet [fixes #76729750]<commit_after>#------------------------------------------------------------------------------
#
# TemplateBuilder
#
# Base class for template builders
#
#------------------------------------------------------------------------------
class TemplateBuilder

  attr_accessor :organization
  attr_accessor :asset_types

  def build

    # Create a new workbook
    p = Axlsx::Package.new
    wb = p.workbook
    
    # Add the worksheet
    sheet = wb.add_worksheet(:name => worksheet_name)

    # Call back to setup any implementation specific options needed
    setup_workbook(wb)

    # setup any styles and cache them for later
    style_cache = {}
    styles.each do |s|
      Rails.logger.debug s.inspect
      style = wb.styles.add_style(s)
      Rails.logger.debug style.inspect
      style_cache[s[:name]] = style
    end
    Rails.logger.debug style_cache.inspect

    # Add the header rows
    header_rows.each do |header_row|
      sheet.add_row header_row
    end

    # add the rows
    add_rows(sheet)

    # Add the column styles
    column_styles.each do |col_style|
      Rails.logger.debug col_style.inspect
      sheet.col_style col_style[:column], style_cache[col_style[:name]]
    end

    # Perform any additional processing
{'fraction_non_alphanumeric': 0.18457405986185726, 'fraction_numerical': 0.0030698388334612432, 'mean_word_length': 1.9128491620111732, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7042423', 'n_tokens_mistral': 738, 'n_tokens_neox': 709, 'n_words': 203}