struct

Ipconv::IPv4

Inherits Comparable < Struct < Value < Object

Constants

SPECIAL_RANGES = [{4278190080_u32, 2130706432_u32, Special::Loopback}, {4278190080_u32, 167772160_u32, Special::Private}, {4293918720_u32, 2886729728_u32, Special::Private}, {4294901760_u32, 3232235520_u32, Special::Private}, {4294901760_u32, 2851995648_u32, Special::LinkLocal}, {4290772992_u32, 1681915904_u32, Special::CarrierGradeNAT}, {4294967040_u32, 3221225984_u32, Special::Documentation}, {4294967040_u32, 3325256704_u32, Special::Documentation}, {4294967040_u32, 3405803776_u32, Special::Documentation}, {4294836224_u32, 3323068416_u32, Special::Benchmarking}, {4294967040_u32, 3221225472_u32, Special::IETFProtocol}, {4026531840_u32, 3758096384_u32, Special::Multicast}, {4026531840_u32, 4026531840_u32, Special::Reserved}]

Constructors

new(addr : UInt32)
Source
new(octets : StaticArray(UInt8, 4))
Source
parse(input : String) : IPv4
Source

Instance methods

+(other : UInt64) : IPv4
Source
-(other : IPv4) : UInt128
Source
<=>(other : IPv4) : Int32

The comparison operator. Returns 0 if the two objects are equal, a negative number if this object is considered less than other, a positive number if this object is considered greater than other, or nil if the two objects are not comparable.

Subclasses define this method to provide class-specific ordering.

The comparison operator is usually used to sort values:

# Sort in a descending way:
[3, 1, 2].sort { |x, y| y <=> x } # => [3, 2, 1]

# Sort in an ascending way:
[3, 1, 2].sort { |x, y| x <=> y } # => [1, 2, 3]
Source
[](index : Int) : UInt8
Source
addr
Source
classify
Source
octets
Source
special
Source
succ
Source
to_binary
Source
to_dotted
Source
to_hex
Source
to_hex_dotted
Source
to_integer
Source
to_octal
Source
to_s(io : IO) : Nil

Same as #inspect(io).

Source

Nested types