Sha256: 4ed712e40b3cc5cb6ef031a4fd1cf0e1c9519385e802e8b58e78a0d4de5b2b3d

Contents?: true

Size: 1.13 KB

Versions: 8

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

require "httpx/version"

require "httpx/extensions"

require "httpx/errors"
require "httpx/callbacks"
require "httpx/loggable"
require "httpx/registry"
require "httpx/transcoder"
require "httpx/options"
require "httpx/timeout"
require "httpx/connection"
require "httpx/headers"
require "httpx/request"
require "httpx/response"
require "httpx/chainable"
require "httpx/client"

# Top-Level Namespace
#
module HTTPX
  # All plugins should be stored under this module/namespace. Can register and load
  # plugins.
  #
  module Plugins
    @plugins = {}

    # Loads a plugin based on a name. If the plugin hasn't been loaded, tries to load
    # it from the load path under "httpx/plugins/" directory.
    #
    def self.load_plugin(name)
      h = @plugins
      unless (plugin = h[name])
        require "httpx/plugins/#{name}"
        raise "Plugin #{name} hasn't been registered" unless (plugin = h[name])
      end
      plugin
    end

    # Registers a plugin (+mod+) in the central store indexed by +name+.
    #
    def self.register_plugin(name, mod)
      @plugins[name] = mod
    end
  end

  extend Chainable
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
httpx-0.2.1 lib/httpx.rb
httpx-0.2.0 lib/httpx.rb
httpx-0.1.0 lib/httpx.rb
httpx-0.0.5 lib/httpx.rb
httpx-0.0.4 lib/httpx.rb
httpx-0.0.3 lib/httpx.rb
httpx-0.0.2 lib/httpx.rb
httpx-0.0.1 lib/httpx.rb