struct

Cl8r::IPAM::IPv4Address

Inherits Comparable < Struct < Value < Object

Represents an IPv4 address backed by a 32-bit unsigned integer (UInt32). Provides zero-allocation arithmetic, comparison, and formatting.

Constructors

from_ipconv(ip : Ipconv::IPv4) : IPv4Address

Creates an IPv4Address from an Ipconv::IPv4 struct.

Source
new(raw : UInt32)

Initializes an IPv4Address from a raw 32-bit integer.

Source
parse(str : String) : IPv4Address

Parses a dot-decimal string representation into an IPv4Address. Raises ArgumentError if the format is invalid or octets are out of range 0..255.

Source

Instance methods

+(other : Int) : IPv4Address

Adds an integer offset to this address, returning a new IPv4Address. Raises OverflowError if the resulting address is out of 32-bit address space.

Source
-(other : Int) : IPv4Address

Subtracts an integer offset from this address.

Source
-(other : IPv4Address) : Int64

Computes the distance (number of addresses) between two IPv4Address values.

Source
<=>(other : IPv4Address) : Int32

Compares this IPv4Address with another based on raw integer values.

Source
classify

Returns the classful networking designation (Class A, B, C, D, or E).

Source
octets

Decomposes the address into a 4-element tuple of 8-bit unsigned octets.

Source
special

Returns the IANA special-purpose designation (e.g. Private, Loopback, Multicast).

Source
to_ipconv

Converts this IPv4Address into an Ipconv::IPv4 representation.

Source
to_s(io : IO) : Nil

Outputs canonical dot-decimal format (e.g. "192.168.1.1") to the given IO.

Source