Sha256: a1bfd6850c878d981bb62af07e8f4a223f6c8fee48ee237d6b405c2ea9f2d159

Contents?: true

Size: 325 Bytes

Versions: 1

Compression:

Stored size: 325 Bytes

Contents

class IPAddr
  PrivateRanges = [
    IPAddr.new("10.0.0.0/8"),
    IPAddr.new("172.16.0.0/12"),
    IPAddr.new("192.168.0.0/16")
  ]

  def private?
    return false unless self.ipv4?
    PrivateRanges.each do |ipr|
      return true if ipr.include?(self)
    end
    return false
  end

  def public?
    !private?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blather-0.4.16 lib/blather/core_ext/ipaddr.rb