Sha256: 683dc8df4980e02f6bbea48768d19b81ca06e56f8b237eae69ad27ad80c05b59

Contents?: true

Size: 447 Bytes

Versions: 20

Compression:

Stored size: 447 Bytes

Contents

require_relative 'url_tokenizer/provider'
require 'facets/hash/symbolize_keys'

module UrlTokenizer
  Error = Class.new StandardError
  class << self
    def provider(name)
      providers.fetch(name.to_sym) do
        raise Error, "unknown provider '#{ name }'"
      end
    end

    def register(provider_hash)
      providers.merge! provider_hash.symbolize_keys
    end

    private
    def providers
      @providers ||= {}
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
url_tokenizer-1.7.0 lib/url_tokenizer.rb
url_tokenizer-1.6.0 lib/url_tokenizer.rb
url_tokenizer-1.5.0 lib/url_tokenizer.rb
url_tokenizer-1.4.3 lib/url_tokenizer.rb
url_tokenizer-1.4.2 lib/url_tokenizer.rb
url_tokenizer-1.4.1 lib/url_tokenizer.rb
url_tokenizer-1.4.0 lib/url_tokenizer.rb
url_tokenizer-1.3.1 lib/url_tokenizer.rb
url_tokenizer-1.3.0 lib/url_tokenizer.rb
url_tokenizer-1.2.1 lib/url_tokenizer.rb
url_tokenizer-1.2.0 lib/url_tokenizer.rb
url_tokenizer-1.1.7 lib/url_tokenizer.rb
url_tokenizer-1.1.6 lib/url_tokenizer.rb
url_tokenizer-1.1.5 lib/url_tokenizer.rb
url_tokenizer-1.1.4 lib/url_tokenizer.rb
url_tokenizer-1.1.3 lib/url_tokenizer.rb
url_tokenizer-1.1.2 lib/url_tokenizer.rb
url_tokenizer-1.1.1 lib/url_tokenizer.rb
url_tokenizer-1.1.0 lib/url_tokenizer.rb
url_tokenizer-1.0.0 lib/url_tokenizer.rb