Class: Inspec::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/inspec/resource.rb

Defined Under Namespace

Classes: Registry

Class Method Summary collapse

Class Method Details

.create_dsl(backend) ⇒ ResourcesDSL

Creates the inner DSL which includes all resources for creating tests. It is always connected to one target, which is specified via the backend argument.



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/inspec/resource.rb', line 25

def self.create_dsl(backend)
  # need the local name, to use it in the module creation further down
  my_registry = registry
  Module.new do
    my_registry.each do |id, r|
      define_method id.to_sym do |*args|
        r.new(backend, id.to_s, *args)
      end
    end
  end
end

.registryObject



15
16
17
# File 'lib/inspec/resource.rb', line 15

def self.registry
  @registry ||= {}
end