--Apple-Mail-7--378559257
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed;
	delsp=yes
Content-Transfer-Encoding: 7bit

> Yes, the quiz is (usually) posted Friday, so submissions typically  
> start rolling in Sunday. And Martin did provide his alcohol  
> submission yesterday. So feel free to post.

OK. <drumroll> my first submission to Ruby-quiz:

(After all those discussion on cheating, I am not sure if this  
solution is not considered cheating of some sort ;-)

===============================================================
require 'rubygems'
require 'cgi'
require 'scrubyt'

begin
google_converter = Scrubyt::Extractor.define do
   fetch "http://www.google.com/search?q=#{CGI::escape(ARGV[0])} 
+#{CGI::escape(ARGV[1])}+to+#{CGI::escape(ARGV[2])}"

   google_result "//td[@dir='ltr']" do
     final_result(/= (.+) /)
   end
end
   puts google_converter.to_hash[0][:final_result]
rescue
   puts "Sorry, even *google* can't translate that!"
end
===============================================================

ex:
ruby converter.rb 10 "meter per second" "mile per hour"
22.3693629

ruby converter.rb 10 USD EUR
7.91201836

ruby converter.rb 7 "ruby gems" "python eggs"
Sorry, even *google* can't translate that!
etc.

disadvantage: you need to be online
advantage: it's quite rich, robust and up-to date (e.g. currency  
conversions)

I am wondering if this solution is (at least somewhat) OK - I have a  
similar one, though that doesn't require you to be on-line. However, I  
am not going to implement it if the above solution is BS :-)

Cheers,
Peter
___
http://www.rubyrailways.com
http://scrubyt.org
--Apple-Mail-7--378559257--