From: unbewusst.sein@... (=?ISO-8859-1?Q?Une_B=E9vue?=) Date: 2010-05-15T23:45:15+09:00 Subject: class best way for getters ? i have a class "HFSFile" initialized by a parsed string after initialization i get a Hash @attr with keys like :name, :creation_date etc... what is the best way to write a getter for each individual key ? the obvious would be for example : def name @attr[:name] end or does exist a more clever way to get all of those getters ? (same name for the getter that the key symbol) another way : def [a_key] return nil unless @attr.keys.include?(a_key) return @attr[a_key] end something like that ? -- � Je suis s�r que la ga�t� ambigu� du dr�le de gar�on qui a bu du whisky et fait le z�bre sur un vieux ca�man � No�l dans le ca�on, a �t� b�n�fique � l'�me du po�te bl�me, ainsi qu'� son c�ur & c�tera ! � (� Jean-Paul Blanc)