From: nobu.nokada@... Date: 2001-12-24T01:03:17+09:00 Subject: [ruby-talk:29365] Re: a better way? At Sun, 23 Dec 2001 23:18:26 +0900, Henning von Rosen wrote: > BTW...so, if ruby was pythonish, > """ > class Temp > Temp.farenheit = Hash.new do |h, c| > puts "Performing calculation...." > h[c] = c * 9 / 5 + 32 > """ > would be all the needed writing... :-) Do you like this? module Temp @farenheit = Hash.new do |h, c| h[c] = c * 9 / 5 + 32 end class << self attr_reader :farenheit end end Temp.farenheit[100] # => 212 Temp.farenheit[200] # => 392 Nobu Nakada