Sha256: bf6711311e8309a70133021f7db35fb592d433cdc3d7c9f09c40f4e5cbe0cecc

Contents?: true

Size: 1006 Bytes

Versions: 17

Compression:

Stored size: 1006 Bytes

Contents

# frozen_string_literal: true

require "sequel"

require_relative "tobox/version"

require "mutex_m"

module Tobox
  class Error < StandardError; end

  module Plugins
    @plugins = {}
    @plugins.extend(Mutex_m)

    # 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.synchronize { h[name] })
        require "tobox/plugins/#{name}"
        raise "Plugin #{name} hasn't been registered" unless (plugin = h.synchronize { h[name] })
      end
      plugin
    end

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

require_relative "tobox/configuration"
require_relative "tobox/fetcher"
require_relative "tobox/worker"
require_relative "tobox/pool"
require_relative "tobox/application"

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
tobox-0.4.5 lib/tobox.rb
tobox-0.4.4 lib/tobox.rb
tobox-0.4.3 lib/tobox.rb
tobox-0.4.2 lib/tobox.rb
tobox-0.4.1 lib/tobox.rb
tobox-0.4.0 lib/tobox.rb
tobox-0.3.2 lib/tobox.rb
tobox-0.3.1 lib/tobox.rb
tobox-0.3.0 lib/tobox.rb
tobox-0.2.0 lib/tobox.rb
tobox-0.1.6 lib/tobox.rb
tobox-0.1.5 lib/tobox.rb
tobox-0.1.4 lib/tobox.rb
tobox-0.1.3 lib/tobox.rb
tobox-0.1.2 lib/tobox.rb
tobox-0.1.1 lib/tobox.rb
tobox-0.1.0 lib/tobox.rb