Method: IPAddress::IPv4#size
- Defined in:
- lib/ipaddress/ipv4.rb
#size ⇒ Object
Returns the number of IP addresses included in the network. It also counts the network address and the broadcast address.
ip = IPAddress("10.0.0.1/29")
ip.size
#=> 8
526 527 528 |
# File 'lib/ipaddress/ipv4.rb', line 526 def size 2 ** @prefix.host_prefix end |