class

Subnet::Prefix128

Inherits Subnet::Prefix / Comparable / Reference / Object

Constructors

new(num = 128)

Creates a new prefix object for 128 bits IPv6 addresses

prefix = Subnet::Prefix128.new 64
# => 64
Source

Instance methods

bits

Transforms the prefix into a string of bits representing the netmask

prefix = Subnet::Prefix128.new 64

prefix.bits
# => "1111111111111111111111111111111111111111111111111111111111111111 \
# => 0000000000000000000000000000000000000000000000000000000000000000"
Source
host_prefix

Returns the length of the host portion of a netmask.

prefix = Prefix128.new 96

prefix.host_prefix
# => 32
Source
to_u128

Unsigned 128 bits decimal number representing the prefix

prefix = Subnet::Prefix128.new 64

prefix.to_u128
# => 340282366920938463444927863358058659840
Source