[Pkg-puppet-devel] [facter] 157/352: (refactor) Extract fact options handling

Stig Sandbeck Mathisen ssm at debian.org
Sun Apr 6 22:21:41 UTC 2014


This is an automated email from the git hooks/post-receive script.

ssm pushed a commit to branch master
in repository facter.

commit 1e63a6bf36ebdf1322ea5972f0cdec7cbc30a522
Author: Adrien Thebo <git at somethingsinistral.net>
Date:   Wed Jan 15 16:15:10 2014 -0800

    (refactor) Extract fact options handling
---
 lib/facter/util/fact.rb | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/lib/facter/util/fact.rb b/lib/facter/util/fact.rb
index 845c1a2..203635b 100644
--- a/lib/facter/util/fact.rb
+++ b/lib/facter/util/fact.rb
@@ -26,17 +26,7 @@ class Facter::Util::Fact
   def initialize(name, options = {})
     @name = name.to_s.downcase.intern
 
-    # LAK:NOTE: This is slow for many options, but generally we won't have any and at
-    # worst we'll have one.  If we add more, this should be made more efficient.
-    options.each do |name, value|
-      case name
-        when :ldapname
-          Facter.warnonce("ldapname is deprecated and will be removed in a future version")
-          self.ldapname = value
-      else
-        raise ArgumentError, "Invalid fact option '%s'" % name
-      end
-    end
+    set_options(options)
 
     @ldapname ||= @name.to_s
 
@@ -136,6 +126,19 @@ class Facter::Util::Fact
     end
   end
 
+  def set_options(options)
+    # LAK:NOTE: This is slow for many options, but generally we won't have any and at
+    # worst we'll have one.  If we add more, this should be made more efficient.
+    options.each do |name, value|
+      case name
+      when :ldapname
+        Facter.warnonce("ldapname is deprecated and will be removed in a future version")
+        self.ldapname = value
+      else
+        raise ArgumentError, "Invalid fact option '%s'" % name
+      end
+    end
+  end
 
   private
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git



More information about the Pkg-puppet-devel mailing list