From: Stefano Crocco Date: 2007-08-02T22:10:45+09:00 Subject: Re: Dynamic method call Alle gioved狸 2 agosto 2007, Todd Burch ha scritto: > This may be slightly different, but I am calling a method dynamically > this way: > > case tool > when "drill" then > @operation = self.method(:drill) ; > when "cut" then > @operation = self.method(:cut) ; > when "bend" then > @operation = self.method(:bend) ; > end > > @operation.call ; # call whatever method was set. > > > Todd If the content of the tool variable are exactly the method names, then you don't need the case statement: @operation = self.method(tool) @operation.call Stefano