vendor/bundle/ruby/1.8/gems/facter-1.6.5/lib/facter/util/fact.rb
# Add a new resolution mechanism.  This requires a block, which will then
# be evaluated in the context of the new mechanism.
Add a new resolution mechanism.  This requires a block, which will then
be evaluated in the context of the new mechanism.
Add a new resolution mechanism . This requires a block which will then be evaluated in the context of the new mechanism .
def add(&block)
    raise ArgumentError, "You must pass a block to Fact<instance>.add" unless block_given?
    begin
      resolve = Facter::Util::Resolution.new(@name)
      resolve.instance_eval(&block)
      @resolves << resolve
      @resolves.sort! { |a, b| b.weight <=> a.weight }
      resolve
    rescue => e
      Facter.warn "Unable to add resolve for #{@name}: #{e}"
      nil
    end
  end
def add ( & block ) raise ArgumentError , "You must pass a block to Fact<instance>.add" unless block_given? begin resolve = Facter :: Util :: Resolution . new ( @name ) resolve . instance_eval ( & block ) @resolves << resolve @resolves . sort! { | a , b | b . weight <=> a . weight } resolve rescue => e Facter . warn "Unable to add resolve for #{@name}: #{e}" nil end end
Add a new resolution mechanism.
Add a new resolution mechanism .
# Immediately sort the resolutions, so that we always have # a sorted list for looking up values.
block