Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

Whois: A New Pure-Ruby Whois Gem

By Ric Roberts / August 13, 2009

guess who?Simone Carletti of Altura Labs recently announced on his blog the release of a new pure-Ruby Whois library, inventively named "Whois".

He needed a whois library for one of his projects, but found that the existing options didn't satisfy his requirement of being able to query both IP addresses and top level domains.  Simone's offering replaces the original whois gem by Cyril Mougel, with which it's backward compatible.

Using the 'all-in-one' whois class-method will give you the default behaviour, with a timeout of 5 seconds. If you want more control you can initialize a new instance of the client:

Whois.whois("rubyinside.com")
# => whois response for rubyinside.com

client = Whois::Client.new
client.timeout = 3
client.query("74.125.67.100")
# => whois response for 74.125.67.100

For more details, check out Simone's blog post, the docs, and the Github repository.

Comments

  1. roger says:

    I also created a "pure ruby which" command recently--apparently pure ruby is cool :)
    http://github.com/rogerdpack/which_ruby/tree/master

  2. Hubert Łępicki says:

    I have recently spoken to someone about "whois" not being able to query both tlds and ip addresses -- but it wasn't Simone! Anyway, the village gossip must have spread fast and hit Italy quickly ;)

Other Posts to Enjoy

Twitter Mentions