Class: PluginRegistry

Inherits:
Object
  • Object
show all
Defined in:
lib/inspec/plugin/v1/registry.rb,
lib/inspec/plugin/v1/registry.rb

Overview

author: Dominik Richter author: Christoph Hartmann

Defined Under Namespace

Classes: Plugin

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePluginRegistry

Returns a new instance of PluginRegistry.



8
9
10
# File 'lib/inspec/plugin/v1/registry.rb', line 8

def initialize
  @registry = {}
end

Instance Attribute Details

#registryObject (readonly)

Returns the value of attribute registry.



6
7
8
# File 'lib/inspec/plugin/v1/registry.rb', line 6

def registry
  @registry
end

Instance Method Details

#resolve(target) ⇒ Plugin

Resolve a target via available plugins.

Parameters:

  • target (String)

    to resolve

Returns:

  • (Plugin)

    plugin instance if it can be resolved, nil otherwise



16
17
18
19
20
21
22
# File 'lib/inspec/plugin/v1/registry.rb', line 16

def resolve(target)
  modules.each do |m|
    res = m.resolve(target)
    return res unless res.nil?
  end
  nil
end