IP::Block
Inherits Comparable < Struct < Value < Object
Constructors
Constructs a new IP::Block 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], XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX/[0-128], or XXXX:XXXX::XXXX:XXXX:XXXX/[0-128].
Raises: MalformedError when the input is malformed.
Constructs a new IPv4 IP::Block 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.
Constructs a new IPv6 IP::Block by interpreting the contents of a given String.
Expects a definition in CIDR notation similar to XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX/[0-128], or XXXX:XXXX::XXXX:XXXX:XXXX/[0-128].
Raises: MalformedError when the input is malformed.
Constructs a new IP::Block from an address and block size.
Raises: MalformedError when the input is malformed.
Class methods
Constructs a new IP::Block 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], XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX/[0-128], or XXXX:XXXX::XXXX:XXXX:XXXX/[0-128].
Returns nil when the input is malformed.
Constructs a new IPv4 IP::Block 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.
Constructs a new IPv6 IP::Block by interpreting the contents of a given String.
Expects a definition in CIDR notation similar to XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX/[0-128], or XXXX:XXXX::XXXX:XXXX:XXXX/[0-128].
Returns nil when the input is malformed.
Instance methods
Compares this block to other returning true if the other block falls before the
block.
Compares this block to other returning true if the other block falls before or
inside the block.
Compares this block with address, returning -1, 0 or +1 depending if the
block is less than, inclusive of, or greater than the other address.
Compares this block with the other block, returning -1, 0 or +1 depending
if the block is less than, inclusive of, or greater than the other block.
Note: This is slightly different then the comparitors due to the added complexity
of a range of values. This is effective for ordering, not comparing inclusivity.
As such this object does not include Comparable for IP::Blocks and the comparative
operators are added manually.
Compares this block to other returning true if the other block is equal to the
receiver.
Compares this block to other returning true if the other block falls after the
block.
Compares this block to other returning true if the other block falls after or
inside the block.
Returns a Bool indicating if the receiver is 'adjacent' to other. That is to
say the receiver is immidiatly beside, but not intersecting other.
Returns a Bool indicating if the receiver 'covers' other. That is to say the receiver
completely includes other.
Returns a Bool indicating if the receiver 'includes' the other address.
Appends a type-specified presentation representation of the block to the
given IO.
Returns a Bool indicating if the receiver 'intersects' other. That is to say the receiver
partially includes other.