Method: NetAddr::IPv4Net#contains
- Defined in:
- lib/ipv4net.rb
#contains(ip) ⇒ Object
contains returns true if the IPv4Net contains the IPv4
65 66 67 68 69 70 71 72 73 |
# File 'lib/ipv4net.rb', line 65 def contains(ip) if (!ip.kind_of?(IPv4)) raise ArgumentError, "Expected an IPv4 object for 'ip' but got a #{ip.class}." end if (@base.addr == ip.addr & @m32.mask) return true end return false end |