Class: NetAddr::CIDRv6
- Inherits:
-
Object
- Object
- NetAddr::CIDRv6
- Defined in:
- lib/ipaccess/patches/netaddr.rb
Overview
This class contains methods extending original CIDRv6 class.
Instance Method Summary collapse
- #ipv4 ⇒ Object (also: #to_ipv4)
Instance Method Details
#ipv4 ⇒ Object Also known as: to_ipv4
115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/ipaccess/patches/netaddr.rb', line 115 def ipv4 if ipv4_mapped? ip = @ip ^ 0xffff00000000 elsif ipv4_compat? ip = @ip else raise VersionError, "Attempted to create version 4 CIDR " + "with non-compliant CIDR item in version #{@version}." end return NetAddr::CIDR.create(ip, :Mask => @netmask >> 96, :Version => 4) end |