class IPAddress::IPv4
- IPAddress::IPv4
- Reference
- Object
Overview
Class IPAddress::IPv4
is used to handle IPv4 type addresses.
Included Modules
- Comparable(IPAddress::IPv4)
- Enumerable(IPAddress::IPv4)
- IPAddress
Defined in:
lib/ipaddress/src/ipaddress/ipv4.crcoffee/extra/ipaddress/ipv4.cr
Class Method Summary
Instance Method Summary
-
#each(&) : Nil
Iterates over all the IP addresses for the given network (or IP address).
- #includes?(other : IPv6)
- #includes?(others : Array(IPv6))
- #includes?(*others : IPv6)
Class Method Detail
Instance Method Detail
def each(&) : Nil
#
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"