module HTTPX::Registry

  1. lib/httpx/registry.rb

Adds a general-purpose registry API to a class. It is designed to be a configuration-level API, i.e. the registry is global to the class and should be set on **boot time**.

It is used internally to associate tags with handlers.

## Register/Fetch

One is strongly advised to register handlers when creating the class.

There is an instance-level method to retrieve from the registry based on the tag:

class Server
  include HTTPX::Registry
  register "tcp", TCPHandler
  register "ssl", SSLHandlers

  def handle(uri)
    scheme = uri.scheme
    handler = registry(scheme) #=> TCPHandler


Public Class

  1. extended
  2. included


Error =  

Base Registry Error

Public Class methods

extended (klass)
[show source]
   # File lib/httpx/registry.rb
36 def self.extended(klass)
37   super
38   klass.extend(ClassMethods)
39 end
included (klass)
[show source]
   # File lib/httpx/registry.rb
41 def self.included(klass)
42   super
43   klass.extend(ClassMethods)
44   klass.__send__(:include, InstanceMethods)
45 end