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.