From: Adriano Nagel Date: 2010-05-20T11:29:19+09:00 Subject: Re: define_method inside instance_eval Dhruva Sagar wrote: > You can do this : > > def status_field(*args) > instance_eval { define_method(:status_all) {|*args| "#{args.join(' > ')}".split } } > end > > or you can do this : > > def status_field(*args) > class << self > def status_all(*args) > "#{args.join(' ')}".split > end > end > end Dhruva, I'd like to get rid of the string manipulation, it would be much cleaner without it. BTW, the args variable is passed to status_field but not to status_all to keep things DRY. Thanks, -- Adriano -- Posted via http://www.ruby-forum.com/.