Module: Tobox::Plugins
- Defined in:
- lib/tobox.rb,
lib/tobox/plugins/inbox.rb,
lib/tobox/plugins/stats.rb,
lib/tobox/plugins/sentry.rb,
lib/tobox/plugins/datadog.rb,
lib/tobox/plugins/progress.rb,
lib/tobox/plugins/zeitwerk.rb,
lib/tobox/plugins/event_grouping.rb
Defined Under Namespace
Modules: Datadog, EventGrouping, Inbox, Progress, Sentry, Stats, Zeitwerk
Class Method Summary collapse
-
.load_plugin(name) ⇒ Object
Loads a plugin based on a name.
-
.register_plugin(name, mod) ⇒ Object
Registers a plugin (
mod) in the central store indexed byname.
Class Method Details
.load_plugin(name) ⇒ Object
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.
21 22 23 24 25 26 27 28 |
# File 'lib/tobox.rb', line 21 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 |
.register_plugin(name, mod) ⇒ Object
Registers a plugin (mod) in the central store indexed by name.
32 33 34 35 |
# File 'lib/tobox.rb', line 32 def self.register_plugin(name, mod) h = @plugins h.synchronize { h[name] = mod } end |