lib/facter.rb
# Allow users to call fact names directly on the Facter class,
# either retrieving the value or comparing it to an existing value.
#
# @api private
Allow users to call fact names directly on the Facter class,
either retrieving the value or comparing it to an existing value.
Allow users to call fact names directly on the Facter class either retrieving the value or comparing it to an existing value .
def method_missing(name, *args)
      question = false
      if name.to_s =~ /\?$/
        question = true
        name = name.to_s.sub(/\?$/,'')
      end
      if fact = collection.fact(name)
        if question
          value = fact.value.downcase
          args.each do |arg|
            if arg.to_s.downcase == value
              return true
            end
          end
          return false
        else
          return fact.value
        end
      else
        raise NoMethodError, "Could not find fact '%s'" % name
      end
    end
def method_missing ( name , * args ) question = false if name . to_s =~ / \? $ / question = true name = name . to_s . sub ( / \? $ / , '' ) end if fact = collection . fact ( name ) if question value = fact . value . downcase args . each do | arg | if arg . to_s . downcase == value return true end end return false else return fact . value end else raise NoMethodError , "Could not find fact '%s'" % name end end
Allow users to call fact names directly on the Facter class,
either retrieving the value or comparing it to an existing value.
Allow users to call fact names directly on the Facter class either retrieving the value or comparing it to an existing value .
# If we got this far, there was no match. # Else, fail like a normal missing method.
name
args
api
None