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û· que la gaûÕambigudu dre de garíÐn qui a bu du
whisky et fait le zïÃre sur un vieux caýÎan NoõÍ dans le can, a ñÕbñÏñÇique l'ãÎe du poïÕe blóÎe, ainsi qu'son c¥¹ur & cëÕera ! ¥µ
(Jean-Paul Blanc)