Class Facter::Util::Resolution
In: lib/facter/util/resolution.rb
Parent: Object

This represents a fact resolution. A resolution is a concrete implementation of a fact. A single fact can have many resolutions and the correct resolution will be chosen at runtime. Each time {Facter.add} is called, a new resolution is created and added to the set of resolutions for the fact named in the call. Each resolution has a {has_weight weight}, which defines its priority over other resolutions, and a set of {confine confinements}, which defines the conditions under which it will be chosen. All confinements must be satisfied for a fact to be considered suitable.

@api public

Methods

Included Modules

Facter::Core::Resolvable Facter::Core::Suitable

Attributes

code  [RW]  @api private
fact  [R]  @!attribute [r] fact @return [Facter::Util::Fact] @api private
name  [RW]  @!attribute [rw] name The name of this resolution. The resolution name should be unique with respect to the given fact. @return [String] @api public
value  [W] 

Public Class methods

Create a new resolution mechanism.

@param name [String] The name of the resolution. @return [void]

@api private

Public Instance methods

Evaluate the given block in the context of this resolution. If a block has already been evaluated emit a warning to that effect.

@return [void]

Sets the code block or external program that will be evaluated to get the value of the fact.

@return [void]

@overload setcode(string)

  Sets an external program to call to get the value of the resolution
  @param [String] string the external program to run to get the
    value

@overload setcode(&block)

  Sets the resolution's value by evaluating a block at runtime
  @param [Proc] block The block to determine the resolution's value.
    This block is run when the fact is evaluated. Errors raised from
    inside the block are rescued and printed to stderr.

@api public

[Validate]