Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Utils for ipaddresses
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
lib/net
test
.gitignore
.travis.yml
Gemfile
MIT-LICENSE
README.md
Rakefile
net-ipaddress.gemspec
reference.md

README.md

net-ipaddress

Build Status Gem Version

Description

Utils for ipaddresses

Features

  • Usuful methods
  • Immutable
  • Now, supporting version4

Usage

Setup

require 'net/ipaddress'
include Net

Basic

ip1 = IPAddress('192.168.1.1/24')
ip2 = IPAddress('192.168.1.10/24')
ip3 = IPAddress('192.168.0.0/16')
ip1.segment? ip2 #=> true
ip2.segment? ip1 #=> true
ip1.segment? ip3 #=> false
ip1.cover? ip3   #=> false
ip3.cover? ip1   #=> true

IPAddr <-> Net::IPAddress

require 'net/ipaddress/ext/ipaddr'

IPAddr.new('192.168.1.1/24') == IPAddress('192.168.1.1/24').network #=> true

Requirements

Installation

$ gem install net-ipaddress

Link

License

The MIT X11 License
Copyright (c) 2012 Kenichi Kamiya
See MIT-LICENSE for further details.

Something went wrong with that request. Please try again.