Ruby Whois 0.9.0: WHOIS parsers, CLI and performances

I'm happy to announce I've just released Whois 0.9.0. This release fixes a lot of bugs and introduces tons several features.

Updated server definitions

Whois 0.9.0 contains updates for the following TLD: .EC, .GL and .MD . Also, there was an issue with all TLD definitions for the server whois.afilias-grs.info that causes the Client to use an invalid adapter.

Improvements to WHOIS parsers

The WHOIS parser architecture has been refactored to provide additional flexibility and reduce code duplications. A new Whois::Answer::Parser::Ast is now available to simplify the creation of AST-based scanners.

New whois parser

The new release includes 15 new WHOIS parsers for 21 top level domains: .fr, .name, .ie, .edu, .info, .gov, .za.net, .eu.org, .za.org, .int/.arpa, .aero, .asia, .bz/.gi/.hn/.lc/.mn/.sc/.vc, .tv and .hu. The .hu and .tv are fully featured parsers while all the others exposes a small subset of properties.

ruby-whois command line improvements

The ruby-whois command line tool now accepts a timeout option to change the 5 seconds default value.

$ ruby-whois google.com -t 20

Also, there was a small bug that prevents the CLI tool to use the right library version which is now fixed.

Whois::Answer::Parser performance boost

The Whois::Answer::Parser no longer tries to require a parser file on every query if the class is already available in the current Ruby environment. This change provides multiple advantages:

  • You can add custom whois parsers without the need to store them in the default Gem directory. Just make sure the parser class is defined before the Answer tries to use it.
  • Huge performance improvements. Each time a require statement is call, Ruby scans all paths in the $LOAD_PATH searching for given file. This is an unnecessary step when the library has already been loaded.

Additional changes

The Whois::Answer class now provides a #properties method to get all properties => values as Hash.

a = Whois.query "google.com"
a.properties
# => { :domain => "google.com", :created_at => ... }

Whois::Client#query automatically casts the qstring to String to prevent the library to crash when a different object is passed as argument.

# because ["google", ".", "com"].to_s translates to "google.com"
# the following statement
a = Whois.query ["google", ".", "com"]

# is equal to
a = Whois.query "google.com"

The #supported method is now deprecated in favor of #property_supported?

a = Whois.query "google.com"
a.property_supported? :disclaimer
# => true

Installation/Update

As usual, you can install/upgrade the library via RubyGems.

$ gem install whois

The Gem is now served by Gemcutter.