struct

IP::Block::IPv4

Inherits IP::Block < Comparable < Struct < Value < Object

Constructors

loopback

Constructs a IP::Block:IPv4 representing the IPv4 loopback block.

Source
new(address : IP::Address::IPv4, block : Int) : self

Constructs a new IP::Block::IPv4 from an address and the block size, [0-32].

Raises: MalformedError when the input is malformed.

Source
new(string : String) : self

Constructs a new IP::Block::IPv4 by interpreting the contents of a given String.

Expects a definition in CIDR notation similar to [0-255].[0-255].[0-255].[0-255]/[0-32].

Raises: MalformedError when the input is malformed.

Source

Class methods

new?(address : IP::Address::IPv4, block : Int) : self | Nil

Constructs a new IP::Block::IPv4 from an address and the block size, [0-32].

Returns nil when the input is malformed.

Source
new?(string : String) : self | Nil

Constructs a new IP::Block::IPv4 by interpreting the contents of a given String.

Expects a definition in CIDR notation similar to [0-255].[0-255].[0-255].[0-255]/[0-32]

Returns nil when the input is malformed.

Source

Instance methods

address

Returns the address component of the block which is also the first address.

Source
block

Returns 'block' size in the form of 2^x, x being the 'size'.

Source
ipv4?

Informs if the block is IPv4 or not.

Source
size

Returns the size of the block in terms of number of addresses.

Source