Method: IPAddress::IPv6.parse_hex
- Defined in:
- lib/ipaddress/ipv6.rb
.parse_hex(hex, prefix = 128) ⇒ Object
Creates a new IPv6 object from a number expressed in hexdecimal format:
ip6 = IPAddress::IPv6::parse_hex("20010db80000000000080800200c417a")
ip6.prefix = 64
ip6.to_string
#=> "2001:db8::8:800:200c:417a/64"
The prefix parameter is optional:
ip6 = IPAddress::IPv6::parse_hex("20010db80000000000080800200c417a", 64)
ip6.to_string
#=> "2001:db8::8:800:200c:417a/64"
627 628 629 |
# File 'lib/ipaddress/ipv6.rb', line 627 def self.parse_hex(hex, prefix=128) self.parse_u128(hex.hex, prefix) end |