From: Shalev NessAiver Date: 2005-08-12T05:29:35+09:00 Subject: Re: Dynamically added methods To clarify - you want to be able to do something like this: class YourObject def initialize @myhash = {'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3'} end end YourObject.new.key1 # Returns 'value1' YourObject.new.key2 # Returns 'value2' .... like that? -Shalev On Aug 11, 2005, at 1:48 PM, Yann Klis wrote: > Hi all, > > I'm pretty new to ruby so I will ask some dumb questions, sorry if > it's > not the right place to ask :) > > I'd like to add some methods dynamically to one of my object. > I understand that with "method_missing" I can "emulate" this > behaviour. > > However, imagine I have an hash table. The key would be the attributes > of my object, and the keys their value. How could I add dynamically > accessors for those attributes/keys ? > > Thanks in advance, > > ++ > > yk > > >