From: Ilias Lazaridis Date: 2005-04-03T20:39:42+09:00 Subject: Re: [EVALUATION] - E03 - jamLang Evaluation Case Applied to Ruby Robert Klemme wrote: [...] >>>> So, the last question for this part: >>>> >>>> how can I add runtime-accessible [meta]data to a ruby function >>>> definition? [...] >> I don't understand. >> >> def talker >> >> def sayHello >> puts "Hello World" >> end >> >> def sayYourName >> puts @name >> end >> >> end >> >> how do I put a "hash" which keeps metadata to each _function_? > > class Module > def meta() @meta ||= {} end > end > > class Foo > def bar() end > meta[:bar] = "bar_meta" > end [...] the above is essentially "class metadata". but it gives me the basic idea: class Object def meta() @meta ||= {} end end talker.sayYourName.meta[:author] = "it's just me" puts talker.sayYourName.meta[:author] => it's just me [i like this language *very* much] - But to understand this fully, can someone please decrypt this: def meta() @meta ||= {} end .. -- http://lazaridis.com