From: Gaudi Mi Date: 2006-03-17T14:11:05+09:00 Subject: Re: Newbie: Reflection question(?) I'll try that, thanks Kev! G Kev Jackson wrote: > Gaudi Mi wrote: > >>At runtime I have the name of a class in a string, and I want to call a >>method on the class having that name. How do I do that? >> >>E.g., let's say that we have several classes that all have a method >>called address(). >>At run-time I know I want to call the method address() on a particular >>class, and that class name is in a string. >> >> > you need to look at call > > eg to instantiate an object (call Object.new) > > m = c.method(:new) > o = m.call > > to call address method > > m = c.method(:address) > m.call > > Kev -- Posted via http://www.ruby-forum.com/.