On Sun, 23 Dec 2001 03:48:19 GMT, nobu.nokada / softhome.net wrote: >Another one using Hash#fetch, > > class Temp > @@save = {} > def fahrenheit(c) > @@save.fetch(c) do > puts "Performing calculation...." > @@save[c] = c * 9 / 5 + 32 > end > end > end > >Or in recent 1.7.2, > > class Temp > @@save = Hash.new do |h, c| > puts "Performing calculation...." > h[c] = c * 9 / 5 + 32 > end > def fahrenheit(c) > @@save[c] > end > end These are way cool. I gather the 1.7.2 feature is new? I think I'm in 1.6 and it doesn't work there. I suppose this means I have to upgrade? What else will I get? And how will I find it? Cool stuff! Ronald E Jeffries http://www.XProgramming.com http://www.objectmentor.com