Method: Inspec::Resource.create_dsl

Defined in:
lib/inspec/resource.rb

.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.

Parameters:

  • backend (BackendRunner)

    exposing the target to resources

Returns:

  • (ResourcesDSL)


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