From: Andrew Wagner Date: 2010-08-16T02:00:40+09:00 Subject: Re: Help with too many methods Thanks. I was on my way out the door when I wrote this and didn't have time to play with it. On Aug 15, 2010, at 12:45 PM, "Pablo Torres N." wrote: > On Sun, Aug 15, 2010 at 07:28, Andrew Wagner wrote: >> Here's one approach: >> >> def get(name,value) >> url_method_name = "create_#{name}".to_sym >> method = # look up create_xxx method, I can't recall the syntax for this >> method.call(value) >> end > > That would be > > def get(name,value) > url_method_name = "create_#{name}".to_sym > method = self.method(url_method_name) > method.call(value) > end > > If you are inside the class; if you are not, first get an object of > said class and replace 'self' for the variable in which you put it. >