<commit_before>module Respect
  # Base class for all DSL evaluation context classes.
  #
  # We can evaluate a block using the {#eval} method. A {DefEvaluator}
  # proxy is used to narrow the evaluation context to a BasicObject so the
  # sub-classes keep Ruby's reflections possibilities without cluttering
  # the DSL itself with many unrelated method names.
  class BaseDef

    class << self

      # Instantiate this evaluation context using the given +args+
      # and evaluate the given +block+ within it.
      def eval(*args, &block)
        new(*args).eval(&block)
      end

      # Return whether the commands of this context accept a name
      # as first argument. All classes not including {DefWithoutName}
      # accept names.
      def accept_name?
        !(self < DefWithoutName)
      end

    end

    # Evaluate the given +block+ in the context of this class through
    # a {DefEvaluator} proxy with this class as target.
    # {#evaluation_result} is called at the end to return the
    # result of this evaluation.
    def eval(&block)
      @def_evaluator ||= DefEvaluator.new(self)
      @def_evaluator.eval(&block)
      evaluation_result
    end

    private

    # Overwrite this method in sub-classes to return the result value
    # of this evaluation context.
    def evaluation_result
      raise NoMethodError, "overwrite me in sub-classes"
    end
  end

end
<commit_msg>Say BaseDef API is experimental.<commit_after>module Respect
  # Base class for all DSL evaluation context classes.
  #
  # You can evaluate a block using the {#eval} method. A {DefEvaluator}
  # proxy is used to narrow the evaluation context to a BasicObject so the
  # sub-classes keep Ruby's reflections possibilities without cluttering
  # the DSL itself with many unrelated method names.
  #
  # End-users are not supposed to sub-class this class yet. Its API is
  # *experimental*.
  class BaseDef

    class << self

      # Instantiate this evaluation context using the given +args+
      # and evaluate the given +block+ within it.
      def eval(*args, &block)
        new(*args).eval(&block)
      end

      # Return whether the commands of this context accept a name
      # as first argument. All classes not including {DefWithoutName}
      # accept names.
      def accept_name?
        !(self < DefWithoutName)
      end

    end

    # Evaluate the given +block+ in the context of this class through
    # a {DefEvaluator} proxy with this class as target.
    # {#evaluation_result} is called at the end to return the
    # result of this evaluation.
    def eval(&block)
      @def_evaluator ||= DefEvaluator.new(self)
      @def_evaluator.eval(&block)
      evaluation_result
    end

    private

    # Overwrite this method in sub-classes to return the result value
    # of this evaluation context.
    def evaluation_result
      raise NoMethodError, "overwrite me in sub-classes"
    end
  end

end

{'fraction_non_alphanumeric': 0.0634162973065121, 'fraction_numerical': 0.0, 'mean_word_length': 2.81038961038961, 'pattern_counts': {'":': 0, '<': 9, '<?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': '7114121', 'n_tokens_mistral': 811, 'n_tokens_neox': 782, 'n_words': 345}