]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
fix namespacing issues
authorJonathan Boyett <jonathan@failingservers.com>
Mon, 9 May 2011 23:23:50 +0000 (16:23 -0700)
committerJonathan Boyett <jonathan@failingservers.com>
Mon, 9 May 2011 23:23:50 +0000 (16:23 -0700)
lib/puppet/util/ipcidr.rb

index 77d9cb28225ccfd49de2507aac301ee6270922c3..3b19bc06c823726ba641dfc555cfebfaa22ff8d8 100644 (file)
 
 require 'ipaddr'
 
-module Puppet::Util::IPCidr < IPAddr
+module Puppet
+  module Util
+    class IPCidr < IPAddr
   
-  def netmask
-    _to_string(@mask_addr)
-  end
+      def netmask
+        _to_string(@mask_addr)
+      end
 
-   def prefixlen
-     m = case @family
-         when Socket::AF_INET
-           IN4MASK
-         when Socket::AF_INET6
-           IN6MASK
-         else
-           raise "unsupported address family"
-         end
-     return $1.length if /\A(1*)(0*)\z/ =~ (@mask_addr & m).to_s(2)
-     raise "bad addr_mask format"
-   end
+      def prefixlen
+        m = case @family
+            when Socket::AF_INET
+              IN4MASK
+            when Socket::AF_INET6
+              IN6MASK
+            else
+              raise "unsupported address family"
+            end
+        return $1.length if /\A(1*)(0*)\z/ =~ (@mask_addr & m).to_s(2)
+        raise "bad addr_mask format"
+      end
 
-   def cidr
-     cidr = sprintf("%s/%s", self.to_s, self.prefixlen)
-     cidr
-   end
+      def cidr
+        cidr = sprintf("%s/%s", self.to_s, self.prefixlen)
+        cidr
+      end
+    end
+  end
 end