<commit_before>require 'singleton'

module HTML
  class Pipeline
    class ValidateContext
      include Singleton
   
      def initialize
        @required_context ||= {}
      end
  
      def required_context
        @required_context
      end
      
      def [](key)
        @required_context[key]
      end

      def []=(key, value)
        @required_context[key] = value
      end
        
    end
  end
end<commit_msg>Added comment to explain ValidateContext.<commit_after>require 'singleton'

module HTML
  class Pipeline
    # Singleton for tracking required context. 
    # Required context can be pushed onto the internal @required_context Hash.
    # For example:
    #
    #   ValidateContext.instance['HTML::Pipeline::CamoFilter'] = [:asset_host]
    #
    # The key needs to be the name of the class that requires the context
    # specified as an array of symbols
    class ValidateContext
      include Singleton
   
      def initialize
        @required_context ||= {}
      end
  
      def required_context
        @required_context
      end
      
      def [](key)
        @required_context[key]
      end

      def []=(key, value)
        @required_context[key] = value
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.06845965770171149, 'fraction_numerical': 0.0, 'mean_word_length': 2.108860759493671, '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': '7643593', 'n_tokens_mistral': 338, 'n_tokens_neox': 338, 'n_words': 104}