From: Kenneth McDonald Date: 2007-08-04T07:03:02+09:00 Subject: Followup question on defining methods dynamically Simple example that doesn't work: ---------------- module Test p "Testing" eval("def foo\np 'OK'\nend") foo end ---------------- 'foo' does not get defined in a place where it can be found by the call on foo, and I get an error. However, when I execute the two lines eval("def foo\np 'OK'\nend") foo in IRB, everything works. I'm guessing that this is a namespace problem, but can't see why it would be. Then again, I'm accustomed to the Python namespace model, and still don't understand all of the ways in which the Ruby model is different. Thanks for any suggestions, Ken