struct IPAddress::Prefix128
- IPAddress::Prefix128
- IPAddress::Prefix
- Struct
- Value
- Object
Defined in:
ipaddress/prefix.crConstructors
-
.new(prefix : Int32 = 128)
Creates a new prefix object for 128 bits IPv6 addresses.
Instance Method Summary
-
#bits : String
Transforms the prefix into a string of bits representing the netmask.
-
#host_prefix : Int32
Returns the length of the host portion of a netmask.
-
#to_big_i : BigInt
Returns unsigned 128 bits decimal number representing the prefix as
BigInt
.
Instance methods inherited from struct IPAddress::Prefix
+(other : Prefix) : Int+(other : Int) : Int +, -(other : Prefix) : Int
-(other : Int) : Int -, <=>(other : Prefix)
<=>(other : Int) <=>, hash(hasher) hash, pred : Prefix pred, prefix : Int32 prefix, succ : Prefix succ, to_i : Int32 to_i, to_s(io : IO) to_s
Constructor methods inherited from struct IPAddress::Prefix
new(prefix : Int)
new
Constructor Detail
def self.new(prefix : Int32 = 128)
#
Creates a new prefix object for 128 bits IPv6 addresses.
prefix = IPAddress::Prefix128.new 64 # => 64
Instance Method Detail
Transforms the prefix into a string of bits representing the netmask.
prefix = IPAddress::Prefix128.new 64
prefix.bits
# => "1111111111111111111111111111111111111111111111111111111111111111"
"0000000000000000000000000000000000000000000000000000000000000000"
def host_prefix : Int32
#
Returns the length of the host portion of a netmask.
prefix = IPAddress::Prefix128.new 96
prefix.host_prefix # => 32
def to_big_i : BigInt
#
Returns unsigned 128 bits decimal number representing
the prefix as BigInt
.
prefix = IPAddress::Prefix128.new 64
prefix.to_big_i # => 340282366920938463444927863358058659840