From: dblack@... Date: 2007-08-02T22:16:09+09:00 Subject: Re: Dynamic method call Hi -- On Thu, 2 Aug 2007, Todd Burch wrote: > 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. Unless I'm missing a subtlety, you could also do that as the somewhat more concise: send(tool) if tool David -- * Books: RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.com)