Skip to content
Utils for ipaddresses
Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit 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.

You can’t perform that action at this time.