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!
Pet = Object.clone.extend(AnimalSounds)
Pet.createSound(“meow”)
fido = Pet.clone
fido.meow # undefined method `meow’ for #Class:0x53c04
(NoMethodError)