summaryrefslogtreecommitdiffstats
path: root/lib/facter.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/facter.rb')
-rw-r--r--lib/facter.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/facter.rb b/lib/facter.rb
index 3c69a94..ac06f68 100644
--- a/lib/facter.rb
+++ b/lib/facter.rb
@@ -68,11 +68,15 @@ module Facter
if string.nil?
return
end
- if @@debug != 0
+ if self.debugging?
puts GREEN + string + RESET
end
end
+ def self.debugging?
+ @@debug != 0
+ end
+
# Return a fact object by name. If you use this, you still have to call
# 'value' on it to retrieve the actual value.
def self.[](name)
@@ -173,6 +177,13 @@ module Facter
end
end
+
+ def self.warn(msg)
+ if Facter.debugging? and msg and not msg.empty?
+ msg.each { |line| Kernel.warn line }
+ end
+ end
+
# Remove them all.
def self.reset
@collection = nil