Method: Facter::Core::Aggregate#evaluate

Defined in:
lib/facter/custom_facts/core/aggregate.rb

#evaluate(&block) ⇒ String

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.

Evaluates the given block

Returns:

  • (String)

    Result of the block’s evaluation

Since:

  • 2.0.0



110
111
112
113
114
115
116
117
118
119
120
# File 'lib/facter/custom_facts/core/aggregate.rb', line 110

def evaluate(&block)
  if @last_evaluated
    msg = +"Already evaluated #{@name}"
    msg << " at #{@last_evaluated}" if msg.is_a? String
    msg << ', reevaluating anyways'
    log.warn msg
  end
  instance_eval(&block)

  @last_evaluated = block.source_location.join(':')
end