From: Robert Klemme Date: 2005-04-03T02:49:44+09:00 Subject: Re: [EVALUATION] - E03 - jamLang Evaluation Case Applied to Ruby "Ilias Lazaridis" schrieb im Newsbeitrag news:d2m0g0$j8q$1@usenet.otenet.gr... > Robert Klemme wrote: >> >> "Ilias Lazaridis" schrieb im Newsbeitrag >> news:d2lm17$2go$1@usenet.otenet.gr... >> >>> Ilias Lazaridis wrote: >>> [...] >>> >>>> I will collect the results and write them down in a document, which >>>> will compare ruby with other languages. >>>> >>>> This document can serve as an flash-start (for people which simply like >>>> to take a look on ruby). >>>> >>>> http://lazaridis.com/case/lang/ruby.html >>> >>> So, the last question for this part: >>> >>> how can I add runtime-accessible [meta]data to a ruby function >>> definition? >>> >>> Any standard to do this? > > ? > >>> Or any suggestions? >> >> Put a hash into the class with symbol as key and whatever meta data you >> need. Add some syntactic sugar and you're done. I'm quite sure someone >> has done that already (maybe even on RAA). > > 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 >> puts Foo.meta[:bar] bar_meta => nil Regards robert > > > >> Kind regards >> >> robert >> > > > -- > http://lazaridis.com