instance method
IPAddr#ipv4_compat
() -> ::IPAddr
ipv4_compat
lib/ipaddr.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/ipaddr.rb, line 380
def ipv4_compat
warn "IPAddr\##{__callee__} is obsolete", uplevel: 1 if $VERBOSE
if !ipv4?
raise InvalidAddressError, "not an IPv4 address: #{@addr}"
end
clone = self.clone.set(@addr, Socket::AF_INET6)
clone.instance_variable_set(:@mask_addr, @mask_addr | 0xffffffffffffffffffffffff00000000)
clone
end
Returns a new ipaddr built by converting the native IPv4 address into an IPv4-compatible IPv6 address.