Method: IPAddress::IPv4#-
- Defined in:
- lib/ipaddress/ipv4.rb
#-(oth) ⇒ Object
Returns the difference between two IP addresses in unsigned int 32 bits format
Example:
ip1 = IPAddress("172.16.10.0/24")
ip2 = IPAddress("172.16.11.0/24")
puts ip1 - ip2
#=> 256
816 817 818 |
# File 'lib/ipaddress/ipv4.rb', line 816 def -(oth) return (to_u32 - oth.to_u32).abs end |