vendor/bundle/ruby/1.8/gems/facter-1.6.5/lib/facter/util/fact.rb
# Return the value for a given fact.  Searches through all of the mechanisms
# and returns either the first value or nil.
Return the value for a given fact.  Searches through all of the mechanisms
and returns either the first value or nil.
Return the value for a given fact . Searches through all of the mechanisms and returns either the first value or nil .
def value
    return @value if @value
    if @resolves.length == 0
      Facter.debug "No resolves for %s" % @name
      return nil
    end
    searching do
      @value = nil
      foundsuits = false
      @value = @resolves.inject(nil) { |result, resolve|
        next unless resolve.suitable?
        foundsuits = true
        tmp = resolve.value
        break tmp unless tmp.nil? or tmp == ""
      }
      unless foundsuits
        Facter.debug "Found no suitable resolves of %s for %s" % [@resolves.length, @name]
      end
    end
    if @value.nil?
      Facter.debug("value for %s is still nil" % @name)
      return nil
    else
      return @value
    end
  end
def value return @value if @value if @resolves . length == 0 Facter . debug "No resolves for %s" % @name return nil end searching do @value = nil foundsuits = false @value = @resolves . inject ( nil ) { | result , resolve | next unless resolve . suitable? foundsuits = true tmp = resolve . value break tmp unless tmp . nil? or tmp == "" } unless foundsuits Facter . debug "Found no suitable resolves of %s for %s" % [ @resolves . length , @name ] end end if @value . nil? Facter . debug ( "value for %s is still nil" % @name ) return nil else return @value end end
Return the value for a given fact.
Return the value for a given fact .
# nothing