From: Ben Bleything Date: 2010-05-16T00:27:37+09:00 Subject: Re: class best way for getters ? 2010/5/15 Une Bévue : > def [a_key] >  return nil unless @attr.keys.include?(a_key) >  return @attr[a_key] > end def []( a_key ) return @attr[a_key] end but yes, that's a good option. By default hashes return nil when you dereference a key that doesn't exist, so unless you've changed that (by creating it with Hash.new(...) or similar) then you can leave that first line out. Ben