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.

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:

  • name (Symbol)

    the name of the implementation

Returns:

  • (Object)

    the runtime implementation

Raises:

  • (ArgumentError)


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

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:

  • name (Symbol)

    the name of the implementation

  • impl (Object)

    the runtime implementation



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

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.



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

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.



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

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