Class: Puppet::Runtime Private

Inherits:
Object show all
Includes:
Singleton
Defined in:
lib/puppet/runtime.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Provides access to runtime implementations.

API:

  • private

Instance Method Summary collapse

Instance Method Details

#[](name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get a runtime implementation.

Parameters:

  • the name of the implementation

Returns:

  • the runtime implementation

Raises:

API:

  • private



40
41
42
43
44
45
46
47
48
49
# File 'lib/puppet/runtime.rb', line 40

def [](name)
  service = @runtime_services[name]
  raise ArgumentError, "Unknown service #{name}" unless service

  if service.is_a?(Proc)
    @runtime_services[name] = service.call
  else
    service
  end
end

#[]=(name, impl) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Register a runtime implementation.

Parameters:

  • the name of the implementation

  • the runtime implementation

API:

  • private



56
57
58
# File 'lib/puppet/runtime.rb', line 56

def []=(name, impl)
  @runtime_services[name] = impl
end

#clearObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Clears all implementations. This is used for testing.

API:

  • private



63
64
65
# File 'lib/puppet/runtime.rb', line 63

def clear
  initialize
end

#load_servicesObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Loads all runtime implementations.

API:

  • private



31
32
33
# File 'lib/puppet/runtime.rb', line 31

def load_services
  @runtime_services.keys.each { |key| self[key] }
end