Class: Buildkite::Builder::PluginManager
- Inherits:
-
Object
- Object
- Buildkite::Builder::PluginManager
- Defined in:
- lib/buildkite/builder/plugin_manager.rb
Instance Method Summary collapse
- #add(name, uri, default_attributes = {}) ⇒ Object
- #build(name, attributes = {}) ⇒ Object
-
#initialize ⇒ PluginManager
constructor
A new instance of PluginManager.
Constructor Details
#initialize ⇒ PluginManager
Returns a new instance of PluginManager.
4 5 6 |
# File 'lib/buildkite/builder/plugin_manager.rb', line 4 def initialize @plugins = {} end |
Instance Method Details
#add(name, uri, default_attributes = {}) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/buildkite/builder/plugin_manager.rb', line 8 def add(name, uri, default_attributes = {}) name = name.to_s raise(ArgumentError, "Plugin already defined: #{name}") if @plugins.key?(name) @plugins[name] = Plugin.new(uri, default_attributes) end |
#build(name, attributes = {}) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/buildkite/builder/plugin_manager.rb', line 15 def build(name, attributes = {}) plugin = @plugins[name.to_s] raise(ArgumentError, "Plugin is not registered: #{name}") unless plugin { plugin.uri => plugin.default_attributes.merge(attributes) } end |