From: dblack@... Date: 2006-11-24T21:53:34+09:00 Subject: Re: Metaprogammatically define methods. Hi -- On Fri, 24 Nov 2006, Max Russell wrote: > Got a bit of help on this one and the solution I'm now going with is: > > File.open('readme.txt').each_line do |entry| > self.send(:define_method, entry.strip.to_sym){ puts "testing > #{entry}" } > #self.send(:public, entry.strip.to_sym ) > end > end define_method takes a string, so you can get rid of "to_sym". (Same for public in the commented-out line, if you ever use that.) David -- David A. Black | dblack@wobblini.net Author of "Ruby for Rails" [1] | Ruby/Rails training & consultancy [3] DABlog (DAB's Weblog) [2] | Co-director, Ruby Central, Inc. [4] [1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com [2] http://dablog.rubypal.com | [4] http://www.rubycentral.org