Files

Class Index [+]

Quicksearch

ruby-ip library

This is a library for manipulating IP addresses.

Installation

Gem

gem install ruby-ip

Source

git clone git://github.com/deploy2/ruby-ip.git

Docs

deploy2.github.com/ruby-ip/

Feature overview

Why not IPAddr?

Ruby bundles an IPAddr class (ipaddr.rb). However there are a number of serious problems with this library.

  1. Given an IP address with a netmask or prefix (e.g. 192.0.2.0/24) it’s very hard to get access to the netmask part. It involves digging around instance variables.

  2. It’s impossible to deal with an off-base address with prefix, because IPAddr forcibly masks it to the base. e.g. 192.0.2.53/24 is stored as 192.0.2.0/24

  3. IPAddr uses calls to the socket library to validate IP addresses, and this can trigger spurious DNS lookups when given an invalid IP address. ruby-ip does not depend on the socket library at all, unless you require ‘ip/socket’ to have access to the Socket::AF_INET and Socket::AF_INET6 constants.

Copying

You may use, distribute and modify this software under the same terms as ruby itself (see LICENSE.txt and COPYING.txt)

[Validate]

Generated with the Darkfish Rdoc Generator 2.