<commit_before>module Dry
  class Matcher
    class Evaluator < BasicObject
      def initialize(result, cases)
        @cases = cases
        @result = result
        @matched = false
        @output = nil
      end

      def call(&block)
        block.call(self)
        @output
      end

      def respond_to_missing?(name, include_private = false)
        @cases.key?(name) || super
      end

      def method_missing(name, *args, &block)
        return super unless @cases.key?(name)

        handle_case @cases[name], *args, &block
      end

      private

      def handle_case(kase, *pattern, &block)
        return @output if @matched

        if kase.matches?(@result, *pattern)
          @matched = true
          @output = block.call(kase.resolve(@result))
        end
      end
    end
  end
end
<commit_msg>Use yield instead of block.call with &block arguments<commit_after>module Dry
  class Matcher
    class Evaluator < BasicObject
      def initialize(result, cases)
        @cases = cases
        @result = result
        @matched = false
        @output = nil
      end

      def call
        yield self
        @output
      end

      def respond_to_missing?(name, include_private = false)
        @cases.key?(name) || super
      end

      def method_missing(name, *args, &block)
        return super unless @cases.key?(name)

        handle_case @cases[name], *args, &block
      end

      private

      def handle_case(kase, *pattern)
        return @output if @matched

        if kase.matches?(@result, *pattern)
          @matched = true
          @output = yield(kase.resolve(@result))
        end
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.08959711365003006, 'fraction_numerical': 0.0, 'mean_word_length': 1.9244288224956063, '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': '6316882', 'n_tokens_mistral': 485, 'n_tokens_neox': 476, 'n_words': 137}