Module: Zen::Service::Plugins
- Defined in:
- lib/zen/service/plugins.rb,
lib/zen/service/plugins/plugin.rb,
lib/zen/service/plugins/rescue.rb,
lib/zen/service/plugins/status.rb,
lib/zen/service/plugins/context.rb,
lib/zen/service/plugins/policies.rb,
lib/zen/service/plugins/pluggable.rb,
lib/zen/service/plugins/assertions.rb,
lib/zen/service/plugins/attributes.rb,
lib/zen/service/plugins/executable.rb,
lib/zen/service/plugins/validation.rb,
lib/zen/service/plugins/execution_cache.rb
Defined Under Namespace
Modules: Assertions, Attributes, Context, Executable, ExecutionCache, Pluggable, Plugin, Policies, Rescue, Status, Validation
Class Method Summary
collapse
Class Method Details
.fetch(name) ⇒ Object
5
6
7
8
9
|
# File 'lib/zen/service/plugins.rb', line 5
def self.fetch(name)
require("zen/service/plugins/#{name}") unless plugins.key?(name)
plugins[name] || raise("extension `#{name}` is not registered")
end
|
.plugins ⇒ Object
22
23
24
|
# File 'lib/zen/service/plugins.rb', line 22
def self.plugins
@plugins ||= {}
end
|
.register(name, extension) ⇒ Object
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/zen/service/plugins.rb', line 11
def self.register(name, extension)
raise(ArgumentError, "extension `#{name}` is already registered") if plugins.key?(name)
plugins[name] =
if (old_name = plugins.key(extension))
plugins.delete(old_name)
else
extension
end
end
|