Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Utils for ipaddresses

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 examples
Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 Gemfile
Octocat-spinner-32 MIT-LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 net-ipaddress.gemspec
Octocat-spinner-32 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.