Ruby — returning a set of baby names

I’m back at Ruby again and glad to be. I’ve got to get myself back into the inner workings of the language and what better way to start than with some good old fashion data scrubbing? This simple script below will lookup all of the baby names from babynames.com and print them out for you.

The next goal is to retrieve all meta data from the names and insert them into a database.

[code lang="ruby"]

require 'net/http'
require 'uri'
require 'cgi'

for letter in 'A'...'z'
lineSplit = Net::HTTP.get(URI.parse('http://www.babynames.com/Names/Alpha/?let=' + letter)).split("\n")
lineSplit.each { |line| print CGI::unescape(Regexp.last_match(1)) + "\n" if line =~ /name_display.php\?n=(.+)">/ }
end
[/code]