Sha256: 73b2bfad706beca227a9c12bd0c04d37393f65dde0a1115899a4725b380948ac

Contents?: true

Size: 337 Bytes

Versions: 37

Compression:

Stored size: 337 Bytes

Contents

# @private
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

37 entries across 37 versions & 2 rubygems

Version Path
blather-2.0.0 lib/blather/core_ext/ipaddr.rb
blather-1.2.0 lib/blather/core_ext/ipaddr.rb
blather-1.1.4 lib/blather/core_ext/ipaddr.rb
blather-1.1.3 lib/blather/core_ext/ipaddr.rb
blather-1.1.2 lib/blather/core_ext/ipaddr.rb
blather-1.1.1 lib/blather/core_ext/ipaddr.rb
blather-1.1.0 lib/blather/core_ext/ipaddr.rb
blather-1.0.0 lib/blather/core_ext/ipaddr.rb
blather-0.8.8 lib/blather/core_ext/ipaddr.rb
blather-0.8.7 lib/blather/core_ext/ipaddr.rb
blather-0.8.6 lib/blather/core_ext/ipaddr.rb
blather-0.8.5 lib/blather/core_ext/ipaddr.rb
blather-0.8.4 lib/blather/core_ext/ipaddr.rb
blather-0.8.3 lib/blather/core_ext/ipaddr.rb
blather-0.8.2 lib/blather/core_ext/ipaddr.rb
tp-blather-0.8.5 lib/blather/core_ext/ipaddr.rb
tp-blather-0.8.4 lib/blather/core_ext/ipaddr.rb
tp-blather-0.8.3 lib/blather/core_ext/ipaddr.rb
tp-blather-0.8.2 lib/blather/core_ext/ipaddr.rb
blather-0.8.1 lib/blather/core_ext/ipaddr.rb