From: Max Russell Date: 2006-11-20T19:41:34+09:00 Subject: Re: Metaprogammatically define methods. > Use define_method whenever possible. The only case where you would put > code in a string (and then load it using eval) is if your methods need > to accept a block argument (define_method does not accept block argument > until Ruby 1.9). > > class Foo > File.open('readme.txt').readlines.each do |entry| > define_method "test_#{entry}".to_sym do > puts "testing #{entry}" > end > end > end > > Foo.new.test_whatever I still run into undefined method errors using this format. Are there any restrictions on the format the generated method name can take? -- Posted via http://www.ruby-forum.com/.