From: Rich Kilmer Date: 2001-10-27T05:02:55+09:00 Subject: [ruby-talk:23511] RE: How to use methID in method_missing def method_missing(methID, *args) # forward to wrapped obj @obj.send(methID, *args) #this should work end > -----Original Message----- > From: Morris, Chris [mailto:chris.morris@snelling.com] > Sent: Friday, October 26, 2001 3:55 PM > To: ruby-talk ML > Subject: [ruby-talk:23510] How to use methID in method_missing > > > The pickaxe method_missing translates methId to a string and uses it as a > parameter to another call. What if I want to pass the method call to a > wrapped object? This doesn't work: > > def method_missing(methID, *args) > # forward to wrapped obj > @obj.methID(*args) > end > > ... eval works (assuming I typed from memory correctly): > > def method_missing(methID, *args) > # forward to wrapped obj > eval "@obj.#{methID.id2name}(#{*args})" > end > > ... is there a non-eval way to do it? > > Chris