From: David Alan Black Date: 2001-07-15T19:15:31+09:00 Subject: [ruby-talk:17878] Re: Creating methods on the fly On Sun, 15 Jul 2001, HarryO wrote: > [I wrote:] > > At any point (inside or outside a class definition), you could do: > > > > meth = "talk" # using string interpolation just to illustrate > > output = "hi" > > Object.module_eval <<-EOE > > def #{meth} > > puts "#{output}" > > end > > EOE > > Just out of interest, what's the difference between using "eval %{ ...}" > and a "here" document as you've suggested? None -- I just use the here document out of habit for multi-line evals. David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav