<commit_before># encoding: utf-8

module Axiom

  # Raised when passing an +uri+ with an unregistered scheme to {Adapter.new}
  UnknownAdapterError = Class.new(StandardError)

  # Provides base functionality for every axiom adapter
  #
  # @todo think about making this a (base) class
  #
  # @example
  #
  #   class MyAdapter
  #     extend Axiom::Adapter
  #     uri_scheme :foo
  #   end
  #
  module Adapter

    # The registry of adapters
    #
    # @return [Hash<String, Object>]
    #   a hash of adapters, keyed by uri scheme
    #
    # @api private
    REGISTRY = {}

    # Return the adapter to use for the given +uri+
    #
    # @param [Addressable::URI] uri
    #   the uri to initialize the adapter with
    #
    # @return [Object]
    #   a axiom adapter
    #
    # @raise [UnknownAdapterError]
    #   when the given +uri+'s scheme is not registered
    #
    # @api private
    def self.build(uri)
      klass = get(uri)

      if klass == Axiom::Adapter::Memory
        klass.new
      else
        klass.new(uri)
      end
    end
<commit_msg>No need to ref memory adapter constant<commit_after># encoding: utf-8

module Axiom

  # Raised when passing an +uri+ with an unregistered scheme to {Adapter.new}
  UnknownAdapterError = Class.new(StandardError)

  # Provides base functionality for every axiom adapter
  #
  # @todo think about making this a (base) class
  #
  # @example
  #
  #   class MyAdapter
  #     extend Axiom::Adapter
  #     uri_scheme :foo
  #   end
  #
  module Adapter

    # The registry of adapters
    #
    # @return [Hash<String, Object>]
    #   a hash of adapters, keyed by uri scheme
    #
    # @api private
    REGISTRY = {}

    # Return the adapter to use for the given +uri+
    #
    # @param [Addressable::URI] uri
    #   the uri to initialize the adapter with
    #
    # @return [Object]
    #   a axiom adapter
    #
    # @raise [UnknownAdapterError]
    #   when the given +uri+'s scheme is not registered
    #
    # @api private
    def self.build(uri)
      klass = get(uri)

      if klass.name == 'Axiom::Adapter::Memory'
        klass.new
      else
        klass.new(uri)
      end
    end

{'fraction_non_alphanumeric': 0.09002770083102493, 'fraction_numerical': 0.0009233610341643582, 'mean_word_length': 2.26355421686747, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4989427', 'n_tokens_mistral': 713, 'n_tokens_neox': 694, 'n_words': 224}