<commit_before>module ActiveScaffold::DataStructures
  # A set of columns. These structures can be nested for organization.
  class ActionColumns < ActiveScaffold::DataStructures::Set
    include ActiveScaffold::Configurable

    # this lets us refer back to the action responsible for this link, if it exists.
    # the immediate need here is to get the crud_type so we can dynamically filter columns from the set.
    attr_accessor :action

    # labels are useful for the Create/Update forms, when we display columns in a grouped fashion and want to name them separately
    attr_writer :label
    def label
      as_(@label) if @label
    end
    def css_class
      @label.to_s.underscore
    end

    # Whether this column set is collapsed by default in contexts where collapsing is supported
    attr_accessor :collapsed
    
    # nests a subgroup in the column set
    def add_subgroup(label, &proc)
      columns = ActiveScaffold::DataStructures::ActionColumns.new
      columns.label = label
      columns.action = self.action
      columns.configure &proc
      self.exclude columns.collect_columns
      self.add columns
    end

    def include?(item)
      @set.each do |c|
        return true if !c.is_a? Symbol and c.include? item<commit_msg>get columns subgroups to add or exclude more columns<commit_after>module ActiveScaffold::DataStructures
  # A set of columns. These structures can be nested for organization.
  class ActionColumns < ActiveScaffold::DataStructures::Set
    include ActiveScaffold::Configurable

    # this lets us refer back to the action responsible for this link, if it exists.
    # the immediate need here is to get the crud_type so we can dynamically filter columns from the set.
    attr_accessor :action

    # labels are useful for the Create/Update forms, when we display columns in a grouped fashion and want to name them separately
    attr_writer :label
    def label
      as_(@label) if @label
    end
    def css_class
      @label.to_s.underscore
    end

    # this is so that array.delete and array.include?, etc., will work by column name
    def ==(other) #:nodoc:
      # another ActionColumns
      if other.class == self.class
        self.label == other.label
      else
        @label.to_s == other.to_s
      end
    end

    # Whether this column set is collapsed by default in contexts where collapsing is supported
    attr_accessor :collapsed
    
    # nests a subgroup in the column set
    def add_subgroup(label, &proc)
      columns = ActiveScaffold::DataStructures::ActionColumns.new
      columns.label = label
      columns.action = self.action
      columns.configure &proc
      self.exclude columns.collect_columns
      self.add columns
    end

    def include?(item)
      @set.each do |c|
        return true if !c.is_a? Symbol and c.include? item
{'fraction_non_alphanumeric': 0.057183198023296855, 'fraction_numerical': 0.0, 'mean_word_length': 2.980337078651685, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '3866842', 'n_tokens_mistral': 777, 'n_tokens_neox': 750, 'n_words': 311}