lib/ipaddress/prefix.rb in ipaddress-0.7.5 vs lib/ipaddress/prefix.rb in ipaddress-0.8.0

- old
+ new

@@ -16,11 +16,11 @@ # both the subclasses. # # IPAddress::Prefix shouldn't be accesses directly, unless # for particular needs. # - class Prefix + class Prefix include Comparable attr_reader :prefix @@ -243,9 +243,22 @@ # prefix.to_u128 # #=> 340282366920938463444927863358058659840 # def to_u128 bits.to_i(2) + end + + # + # Returns the length of the host portion + # of a netmask. + # + # prefix = Prefix128.new 96 + # + # prefix.host_prefix + # #=> 32 + # + def host_prefix + 128 - @prefix end end # class Prefix123 < Prefix end # module IPAddress