<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <id>tag:refactormycode.com,2007:users586</id>
  <link type="application/atom+xml" href="http://refactormycode.com/users/586" rel="self"/>
  <title>MexicanHacker</title>
  <updated>Mon May 12 15:19:07 +0000 2008</updated>
  <entry>
    <id>tag:refactormycode.com,2007:Code296</id>
    <published>2008-05-12T15:19:07+00:00</published>
    <updated>2008-05-23T18:19:30+00:00</updated>
    <title>[Ruby] Whois refactoring</title>
    <content type="html">&lt;p&gt;I'm new to ruby and I make this quick program to check if a domain is available, can we improve it?&lt;/p&gt;

&lt;pre&gt;class WhoIsQuery
    query = ARGV[0]
    puts &amp;quot;Querying whois with #{query} ...&amp;quot;
    results = IO.popen(&amp;quot;whois -Q #{query}&amp;quot;)
    message = &amp;quot;No more domain for you!!&amp;quot;
    results.readlines.each do |line|
        if line.include?(&amp;quot;No match for &amp;quot;)
            message = &amp;quot;Domain waiting for you...&amp;quot;
            break
        end
    end
    puts message
end
&lt;/pre&gt;</content>
    <author>
      <name>MexicanHacker</name>
      <email>oscar@mexicanhacker.com</email>
    </author>
    <link type="text/html" href="http://refactormycode.com/codes/296-whois-refactoring" rel="alternate"/>
  </entry>
</feed>
