include?(other) public

Returns true if the given ipaddr is in the range.

e.g.:

  require 'ipaddr'
  net1 = IPAddr.new("192.168.2.0/24")
  p net1.include?(IPAddr.new("192.168.2.0"))        #=> true
  p net1.include?(IPAddr.new("192.168.2.255"))      #=> true
  p net1.include?(IPAddr.new("192.168.3.0"))        #=> false
Show source
Register or log in to add new notes.