<commit_before>module ActiveRecord

  # = Active Record Dynamic Finder Match
  #
  # Refer to ActiveRecord::Base documentation for Dynamic attribute-based finders for detailed info
  #
  class DynamicFinderMatch
    def self.match(method)
      method = method.to_s
      klass = [FindBy, FindByBang, FindOrInitializeCreateBy].find do |klass|
        klass.matches?(method)
      end
      klass.new(method) if klass
    end

    def self.matches?(method)
      method =~ self::METHOD_PATTERN
    end

    def initialize(method)
      @finder = :first
      @instantiator = nil
      match_data = method.match(self.class::METHOD_PATTERN)
      @attribute_names = match_data[-1].split("_and_")
      initialize_from_match_data(match_data)
    end

    attr_reader :finder, :attribute_names, :instantiator

    def finder?
      @finder && !@instantiator
    end

    def creator?
      @finder == :first && @instantiator == :create
    end

    def instantiator?
      @instantiator
    end<commit_msg>warning removed: shadowing outer local variable - klass<commit_after>module ActiveRecord

  # = Active Record Dynamic Finder Match
  #
  # Refer to ActiveRecord::Base documentation for Dynamic attribute-based finders for detailed info
  #
  class DynamicFinderMatch
    def self.match(method)
      method = method.to_s
      klass = [FindBy, FindByBang, FindOrInitializeCreateBy].find do |_klass|
        _klass.matches?(method)
      end
      klass.new(method) if klass
    end

    def self.matches?(method)
      method =~ self::METHOD_PATTERN
    end

    def initialize(method)
      @finder = :first
      @instantiator = nil
      match_data = method.match(self.class::METHOD_PATTERN)
      @attribute_names = match_data[-1].split("_and_")
      initialize_from_match_data(match_data)
    end

    attr_reader :finder, :attribute_names, :instantiator

    def finder?
      @finder && !@instantiator
    end

    def creator?
      @finder == :first && @instantiator == :create
    end

    def instantiator?
      @instantiator
    end
{'fraction_non_alphanumeric': 0.08797653958944282, 'fraction_numerical': 0.0009775171065493646, 'mean_word_length': 2.9593810444874276, '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': '2398894', 'n_tokens_mistral': 624, 'n_tokens_neox': 606, 'n_words': 151}