Class: Inspec::Resource

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

Class Method Summary collapse

Class Method Details

.create_dsl(backend, my_registry = registry) ⇒ 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.



28
29
30
31
32
33
34
35
36
37
# File 'lib/inspec/resource.rb', line 28

def self.create_dsl(backend, my_registry = registry)
  # need the local name, to use it in the module creation further down
  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

.default_registryObject



10
11
12
# File 'lib/inspec/resource.rb', line 10

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

.new_registryObject



18
19
20
# File 'lib/inspec/resource.rb', line 18

def self.new_registry
  default_registry.dup
end

.registryObject



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

def self.registry
  @registry ||= default_registry
end