class Subnet::Prefix128
- Subnet::Prefix128
- Subnet::Prefix
- Reference
- Object
Defined in:
subnet/prefix.crConstructors
-
.new(num = 128)
Creates a new prefix object for 128 bits IPv6 addresses
Instance Method Summary
-
#bits
Transforms the prefix into a string of bits representing the netmask
-
#host_prefix
Returns the length of the host portion of a netmask.
-
#to_u128
Unsigned 128 bits decimal number representing the prefix
Instance methods inherited from class Subnet::Prefix
+(other)
+,
-(other)
-,
<=>(other)
<=>,
prefix : Int32
prefix,
prefix=(prefix : Int32)
prefix=,
to_i : Int32
to_i,
to_s(io)
to_s
Constructor methods inherited from class Subnet::Prefix
new(num)
new
Constructor Detail
def self.new(num = 128)
#
Creates a new prefix object for 128 bits IPv6 addresses
prefix = Subnet::Prefix128.new 64
# => 64
Instance Method Detail
def bits
#
Transforms the prefix into a string of bits representing the netmask
prefix = Subnet::Prefix128.new 64
prefix.bits
# => "1111111111111111111111111111111111111111111111111111111111111111 \
# => 0000000000000000000000000000000000000000000000000000000000000000"
def host_prefix
#
Returns the length of the host portion of a netmask.
prefix = Prefix128.new 96
prefix.host_prefix
# => 32
def to_u128
#
Unsigned 128 bits decimal number representing the prefix
prefix = Subnet::Prefix128.new 64
prefix.to_u128
# => 340282366920938463444927863358058659840