<commit_before>module Coalesce
  class Combiner
    attr_reader :attribute, :with, :options

    def initialize(attribute, with: nil, **options, &block)
      if with && block
        fail ArgumentError, "cannot provide both :with and block"
      end

      # default to the block if given, or :array
      @with = with || block || :array

      @attribute, @options = attribute, options
    end

    def self.build_list(*attr_names, **kw, &block)
      attr_names.map do |attr_name|
        new(attr_name, **kw, &block)
      end
    end

    def call(values)
      callable = with.respond_to?(:call) ? with : self.class.method(@with)

      if callable.parameters.size == 1
        callable.call(values)
      else<commit_msg>consistently use attribute with vs. @with<commit_after>module Coalesce
  class Combiner
    attr_reader :attribute, :with, :options

    def initialize(attribute, with: nil, **options, &block)
      if with && block
        fail ArgumentError, "cannot provide both :with and block"
      end

      # default to the block if given, or :array
      @with = with || block || :array
      @attribute, @options = attribute, options
    end

    def self.build_list(*attr_names, **kw, &block)
      attr_names.map do |attr_name|
        new(attr_name, **kw, &block)
      end
    end

    def call(values)
      callable = with.respond_to?(:call) ? with : self.class.method(with)

      if callable.parameters.size == 1
        callable.call(values)
      else
{'fraction_non_alphanumeric': 0.10714285714285714, 'fraction_numerical': 0.0013477088948787063, 'mean_word_length': 2.6757425742574257, 'pattern_counts': {'":': 0, '<': 3, '<?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': '322937', 'n_tokens_mistral': 457, 'n_tokens_neox': 442, 'n_words': 138}