Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
IPAddr#zone_id=
zone_id=(zid)
lib/ipaddr.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/lib/ipaddr.rb, line 522
def zone_id=(zid)
if @family == Socket::AF_INET6
case zid
when nil, /\A%(\w+)\z/
@zone_id = zid
else
raise InvalidAddressError, "invalid zone identifier for address"
end
else
raise InvalidAddressError, "not an IPv6 address"
end
end
Returns the IPv6 zone identifier, if present. Raises InvalidAddressError if not an IPv6 address.