From: Vincent Fourmond Date: 2007-01-20T04:03:10+09:00 Subject: Re: what's wrong with this snippet ... Jimmy Kofler wrote: > Hi, all! > I've just stumbled over this orphaned snippet on my hard drive that > returns a NoMethodError message instead of "Method meow called"! > Is there a workaround? > Thanks! > > > AnimalSounds = Module.new > > AnimalSounds.class_eval %q! > def createSound(attr_name) > class_eval <<-EOS > def #{attr_name}; puts "Method #{attr_name} called"; end > EOS > end! This creates an instance method and not a class method. Consider using def self.#{attr_name}. Cheers, Vince -- Vincent Fourmond, PhD student http://vincent.fourmond.neuf.fr/