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)

30
31
32
33
34
35
36
37
38
39
# File 'lib/puppet/runtime.rb', line 30

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


46
47
48
# File 'lib/puppet/runtime.rb', line 46

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.


53
54
55
# File 'lib/puppet/runtime.rb', line 53

def clear
  initialize
end