Module: Excom::Plugins
- Defined in:
- lib/excom/plugins.rb
Defined Under Namespace
Modules: Args, Assertions, Caching, Context, DryTypes, Errors, Executable, FailureCause, Pluggable, Rescue, Sentry, Status
Class Method Summary
collapse
Class Method Details
.fetch(name) ⇒ Object
10
11
12
13
14
|
# File 'lib/excom/plugins.rb', line 10
def fetch(name)
require("excom/plugins/#{name}") unless plugins.key?(name)
plugins[name] || raise("extension `#{name}` is not registered")
end
|
.plugins ⇒ Object
24
25
26
|
# File 'lib/excom/plugins.rb', line 24
def plugins
@plugins ||= {}
end
|
.register(name, extension, options = {}) ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/excom/plugins.rb', line 16
def register(name, extension, options = {})
if plugins.key?(name)
raise ArgumentError, "extension `#{name}` is already registered"
end
extension.singleton_class.send(:define_method, :excom_options) { options }
plugins[name] = extension
end
|