class

IPAddress::IPv4

Inherits Comparable < Enumerable < IPAddress < Reference < Object

Class IPAddress::IPv4 is used to handle IPv4 type addresses.

Class methods

parse_u32_address(u32, prefix = 32) : IPAddress
Source

Instance methods

each

Iterates over all the IP addresses for the given network (or IP address).

The object yielded is a new IPv4 object created from the iteration.

ip = IPAddress.new "10.0.0.1/29"
ip.each do |i|
  p i.address
end

# => "10.0.0.0"
# => "10.0.0.1"
# => "10.0.0.2"
# => "10.0.0.3"
# => "10.0.0.4"
# => "10.0.0.5"
# => "10.0.0.6"
# => "10.0.0.7"
Source
includes?(other : IPv6)
Source
includes?(others : Array(IPv6))
Source
includes?(host : String)
Source
includes?(ip_address : Socket::IPAddress)
Source
includes?(*others : IPv6)
Source