<commit_before>module Rack
  class SnapSearch
    
    # TODO: YARD
    class Config
      
      # TODO: YARD
      def initialize(middleware, options={})
        @middleware = middleware
        
        [:email, :key, :on_exception].each do |attribute|
          send( "#{attribute}=", options[attribute] ) if options.has_key?(attribute)
        end
      end
      
      attr_reader :email, :key
      
      # TODO: YARD
      def email=(value)
        # TODO: Complain if not string/valid email (super simple regexp)
        @email = value
      end
      
      # TODO: YARD
      def key=(value)
        # TODO: Complain if not string
        @key = value
      end
      
      # TODO: YARD
      def on_exception=(block)
        # TODO: Complain if not Proc
        @on_exception = block
      end
      
      # TODO: YARD
      def on_exception(&block)
        @on_exception = block if block_given?
        
        @on_exception
      end
      
    end
    
  end
end<commit_msg>Documentation for Rack::SnapSearch::Config<commit_after>module Rack
  class SnapSearch
    
    # The configuration class for the Rack middleware. Simply holds the email, key, and on_exception attributes
    class Config
      
      # Create a new instance.
      # 
      # @param [Hash] options The options to initialize this instance with.
      # @option options [String] :email The email to authenticate with.
      # @option options [String] :key The key to authenticate with.
      # @option options [Proc] :on_exception The block to run when an exception within SnapSearch occurs.
      def initialize(options={})
        [:email, :key, :on_exception].each do |attribute|
          send( "#{attribute}=", options[attribute] ) if options.has_key?(attribute)
        end
      end
      
      attr_reader :email, :key
      
      # Setter for the `email` attribute.
      # 
      # @param [String, #to_s] value The value to set the attribute as.
      # @return [String] The new value.
      def email=(value)
        raise TypeError, 'email must be a String or respond to #to_s' unless value.is_a?(String) || respond_to?(:to_s)
        
        @email = value.to_s
      end
      
      # Setter for the `key` attribute.
      # 
      # @param [String, #to_s] value The value to set the attribute as.
      # @return [String] The new value.
      def key=(value)
        raise TypeError, 'key must be a String or respond to #to_s' unless value.is_a?(String) || respond_to?(:to_s)
        
        @key = value.to_s
      end
      
      # Setter for the `on_exception` attribute.
      # 
      # @param [Proc, #call] value The value to set the attribute as.
      # @return [Proc, #call] The new value.
      def on_exception=(value)
        raise TypeError, 'on_exception must be a Proc or respond to #call' unless value.is_a?(Proc) || value.respond_to?(:call)
        
        @on_exception = value
      end
      
      # Getter/Setter for the `on_exception` attribute.
      # 
      # @yield If given, the Proc to set the attribute as.
      # @return [Proc] The new value.
      def on_exception(&value)
        @on_exception = value if block_given?
        
        @on_exception
      end
      
    end
    
  end
end
{'fraction_non_alphanumeric': 0.08868974042027195, 'fraction_numerical': 0.0, 'mean_word_length': 1.9779208831646735, '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': '793121', 'n_tokens_mistral': 958, 'n_tokens_neox': 945, 'n_words': 320}