struct

IPAddress::Prefix128

Inherits IPAddress::Prefix < Comparable < Comparable < Struct < Value < Object

Constructors

new(prefix : Int32 = 128)

Creates a new prefix object for 128 bits IPv6 addresses.

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

Instance methods

bits

Transforms the prefix into a string of bits representing the netmask.

prefix = IPAddress::Prefix128.new 64
prefix.bits
  # => "1111111111111111111111111111111111111111111111111111111111111111"
       "0000000000000000000000000000000000000000000000000000000000000000"
Source
host_prefix

Returns the length of the host portion of a netmask.

prefix = IPAddress::Prefix128.new 96
prefix.host_prefix # => 32
Source
to_big_i

Returns unsigned 128 bits decimal number representing the prefix as BigInt.

prefix = IPAddress::Prefix128.new 64
prefix.to_big_i # => 340282366920938463444927863358058659840
Source