<commit_before>require 'active_support/concern'

module Frameworks
  module Base
    extend ActiveSupport::Concern

    included do
      attr_accessor :project
      attr_accessor :options

      define_method :initialize do |project|
        self.project = project
        self.options = {}
      end
    end

    module InstanceMethods
      def filter_with(args, filters)
        args.select do |arg|
          filters.any? do |key, value|
            case value
            when Regexp
              arg =~ value
            when Proc
              value.call(arg)
            else
              raise "Unknown filter type for #{value}"
            end
          end
        end
      end

      def to_s
        self.class.name.split("::").last
      end
    end
  end

  class RSpec
    include Frameworks::Base

    def present?
      project.has_file?("spec")
    end

    def filter(*args)
      filter_with(args, {
        :is_spec_file   => /_spec\.rb$/,
        :is_in_spec_dir => /spec/,<commit_msg>Fix regex for RSpec file filtering<commit_after>require 'active_support/concern'

module Frameworks
  module Base
    extend ActiveSupport::Concern

    included do
      attr_accessor :project
      attr_accessor :options

      define_method :initialize do |project|
        self.project = project
        self.options = {}
      end
    end

    module InstanceMethods
      def filter_with(args, filters)
        args.select do |arg|
          filters.any? do |key, value|
            case value
            when Regexp
              arg =~ value
            when Proc
              value.call(arg)
            else
              raise "Unknown filter type for #{value}"
            end
          end
        end
      end

      def to_s
        self.class.name.split("::").last
      end
    end
  end

  class RSpec
    include Frameworks::Base

    def present?
      project.has_file?("spec")
    end

    def filter(*args)
      filter_with(args, {
        :is_spec_file   => /_spec\.rb$/,
        :is_in_spec_dir => /^spec/,
{'fraction_non_alphanumeric': 0.07861328125, 'fraction_numerical': 0.0, 'mean_word_length': 1.6135204081632653, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 7, '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': '3801816', 'n_tokens_mistral': 593, 'n_tokens_neox': 575, 'n_words': 156}