<commit_before># frozen_string_literal: true

# Component Reference: https://design-system.service.gov.uk/components/table/

module GovukComponent
  module TableHelpers
    def govuk_table(tag_options = {}, &block)
      tag_options = prepend_classes('govuk-table app-table--responsive', tag_options)

      tag.table(capture(&block), tag_options)
    end

    def govuk_table_caption(tag_options = {}, &block)
      tag_options = prepend_classes('govuk-table__caption', tag_options)

      tag.caption(capture(&block), tag_options)
    end

    def govuk_table_thead(tag_options = {}, &block)
      tag_options = prepend_classes('govuk-table__head', tag_options)

      tag.thead(capture(&block), tag_options)
    end

    def govuk_table_tbody(tag_options = {}, &block)
      tag_options = prepend_classes('govuk-table__body', tag_options)

      tag.tbody(capture(&block), tag_options)
    end

    def govuk_table_tfoot(tag_options = {}, &block)
      tag_options = prepend_classes('govuk-table__foot', tag_options)

      tag.tfoot(capture(&block), tag_options)
    end

    def govuk_table_row(tag_options = {}, &block)
      tag_options = prepend_classes('govuk-table__row', tag_options)

      tag.tr(capture(&block), tag_options)
    end

    def govuk_table_th(tag_options = {}, &block)
      tag_options = prepend_classes('govuk-table__header', tag_options)
      tag_options[:scope] = tag_options[:scope].presence || 'col'

      tag.th(capture(&block), tag_options)
    end

    def govuk_table_th_numeric(tag_options = {}, &block)
      tag_options = prepend_classes('govuk-table__header govuk-table__header--numeric', tag_options)
      tag_options[:scope] = tag_options[:scope].presence || 'col'

      tag.th(capture(&block), tag_options)
    end

    def govuk_table_td(tag_options = {}, &block)
      tag_options = prepend_classes('govuk-table__cell', tag_options)

      tag.td(capture(&block), tag_options)
    end

    def govuk_table_td_numeric(tag_options = {}, &block)
      tag_options = prepend_classes('govuk-table__cell govuk-table__cell--numeric', tag_options)

      tag.td(capture(&block), tag_options)
    end

    def govuk_table_and_caption(caption = nil, tag_options = {}, &block)
      govuk_table do
        concat(govuk_table_caption(tag_options) { caption })
        concat(capture(&block))
      end
    end

    def govuk_table_thead_collection(data_collections)
      govuk_table_thead do
        govuk_table_row do
          data_collections.each do |datum|
            concat(govuk_table_th { datum })
          end
        end
      end
    end

    def govuk_table_tbody_collection(data_collections)
      govuk_table_tbody do
        table_rows = data_collections.map do |row|
          row.map do |data_cell|
            govuk_table_td { data_cell }
          end.join
        end<commit_msg>Fix ruby 2.7 kwarg deprecation warnings coming out in cucumber<commit_after># frozen_string_literal: true

# Component Reference: https://design-system.service.gov.uk/components/table/

module GovukComponent
  module TableHelpers
    def govuk_table(tag_options = {}, &block)
      tag_options = prepend_classes('govuk-table app-table--responsive', tag_options)

      tag.table(capture(&block), **tag_options)
    end

    def govuk_table_caption(tag_options = {}, &block)
      tag_options = prepend_classes('govuk-table__caption', tag_options)

      tag.caption(capture(&block), **tag_options)
    end

    def govuk_table_thead(tag_options = {}, &block)
      tag_options = prepend_classes('govuk-table__head', tag_options)

      tag.thead(capture(&block), **tag_options)
    end

    def govuk_table_tbody(tag_options = {}, &block)
      tag_options = prepend_classes('govuk-table__body', tag_options)

      tag.tbody(capture(&block), **tag_options)
    end

    def govuk_table_tfoot(tag_options = {}, &block)
      tag_options = prepend_classes('govuk-table__foot', tag_options)

      tag.tfoot(capture(&block), **tag_options)
    end

    def govuk_table_row(tag_options = {}, &block)
      tag_options = prepend_classes('govuk-table__row', tag_options)

      tag.tr(capture(&block), **tag_options)
    end

    def govuk_table_th(tag_options = {}, &block)
      tag_options = prepend_classes('govuk-table__header', tag_options)
      tag_options[:scope] = tag_options[:scope].presence || 'col'

      tag.th(capture(&block), **tag_options)
    end

    def govuk_table_th_numeric(tag_options = {}, &block)
      tag_options = prepend_classes('govuk-table__header govuk-table__header--numeric', tag_options)
      tag_options[:scope] = tag_options[:scope].presence || 'col'

      tag.th(capture(&block), **tag_options)
    end

    def govuk_table_td(tag_options = {}, &block)
      tag_options = prepend_classes('govuk-table__cell', tag_options)

      tag.td(capture(&block), **tag_options)
    end

    def govuk_table_td_numeric(tag_options = {}, &block)
      tag_options = prepend_classes('govuk-table__cell govuk-table__cell--numeric', tag_options)

      tag.td(capture(&block), **tag_options)
    end

    def govuk_table_and_caption(caption = nil, tag_options = {}, &block)
      govuk_table do
        concat(govuk_table_caption(tag_options) { caption })
        concat(capture(&block))
      end
    end

    def govuk_table_thead_collection(data_collections)
      govuk_table_thead do
        govuk_table_row do
          data_collections.each do |datum|
            concat(govuk_table_th { datum })
          end
        end
      end
    end

    def govuk_table_tbody_collection(data_collections)
      govuk_table_tbody do
        table_rows = data_collections.map do |row|
          row.map do |data_cell|
            govuk_table_td { data_cell }
          end.join
        end
{'fraction_non_alphanumeric': 0.10832898626325857, 'fraction_numerical': 0.0003477656059815684, 'mean_word_length': 3.4623739332816137, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '2347701', 'n_tokens_mistral': 1923, 'n_tokens_neox': 1846, 'n_words': 310}