Find out if an IP is within a range of IPs

Viewed 14582

How can you tell if an ip, say 62.156.244.13 is within the range of 62.0.0.0 and 62.255.255.255

7 Answers

There is a method #include?

And you can do just:

IPAddr.new("127.0.0.1/8").include? "127.1.10.200"

Related