On Thu, 1 Sep 2005, Gavin Kistner wrote: > Last night I was sleepily trying to calculate the sustained transfer rate my > web server would need to maintain to reach my quoted quota of 300GB/month > transfter. It sparked an idea, and this morning I played around with some > inferential unit conversion code. I don't have the energy to finish it off > (it's more than just polish), but thought I'd share it anyhow. I like the > syntax it allows :) > > Example code usage: > > Units.add_conversion( 60.seconds, 1.minute ) > Units.add_conversion( 1.mile_per_hour, 1.46666667.feet_per_second ) > puts ( 32.feet_per_second_second * 1.5.minutes.in_seconds ).in_miles_per_hour > #=> 1963.63635917355 miles/hour > > distance = 3.feet > time = 1.second > rate = distance / time > puts rate, rate / 3 > #=> 3 feet/second > #=> 1 foot/second > > puts 18.camels * 12.days / 4.cows + 89.widget_jobbers > #=> ((54 camel*day/cow) + (89 jobber*widget)) you might be interested in this: http://raa.ruby-lang.org/project/quanty/ you're code looks very interesting too though... cheers. -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | Your life dwells amoung the causes of death | Like a lamp standing in a strong breeze. --Nagarjuna ===============================================================================