From: Francis Hwang Date: 2005-06-05T03:09:39+09:00 Subject: Re: Calling a procedure with dinamyc name You could look at either Object#methods or Object#respond_to? depending on how you want to do it. On Jun 4, 2005, at 2:05 PM, Marcelo Paniagua wrote: > For the the Kirbybase it seems like the right option. As for the > other example I have my doubts. What I want to do in that > case is something like this: I have an object of class Card. I want > to look though the object methods and find out if it has > an "onPlay" method, "onLefPlay" method, and so on. I want to do this > in order to let the user knows that he can use those > methods in a given time... Which option do you think is the right > option? > > Marcelo > > > > Francis Hwang escribi�: > >> >> On Jun 4, 2005, at 1:52 PM, Marcelo Paniagua wrote: >> >>> Hi there! >>> >>> I'm using Kirbybase database and it has the peculiar way to access >>> fields data though methods. Is it posible to call such methods >>> passing the fieldname in a dinamic way? >>> >>> instead of >>> >>> client_id = table.client_id >>> >>> I would like to use sometime like >>> >>> field = 'client_id' >>> client_id = table.field or something like that. >>> >>> This is also applicable to a program that I'm developing, in which >>> I want to find if a class has a given method... for example, I want >>> to >>> find if a class Card has an "onplay" method. >>> Thanks >>> >> >> Maybe you want this: >> >> field = 'client_id' >> client_id = table.send field >> >> or maybe you want this >> >> method = table.method :client_id >> client_id = method.call >> >> ... you've got quite a few options. >> >> >> >>> -- >>> Este correo esta libre de virus! >>> >>> >>> >> >> Francis Hwang >> http://fhwang.net/ >> >> >> > > -- > Este correo esta libre de virus! > > > Francis Hwang http://fhwang.net/