-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi. I'm not seeing what I thought would happen with some eval code, here is a sample via irb: chandler@greyhound:~$ irb irb(main):001:0> class FooBar irb(main):002:1> def baz irb(main):003:2> puts "foobar:baz" irb(main):004:2> end irb(main):005:1> end nil irb(main):006:0> f = FooBar.new #<FooBar:0x4027e828> irb(main):007:0> f.baz foobar:baz nil OK. So far so good, simply made a test class and ran a method from it. irb(main):009:0> eval("class FooBar\ndef baz\nputs 'foobar:new baz'\nend\nend") nil irb(main):010:0> f.baz foobar:new baz nil OK. So far even better. Use eval to redefine method. irb(main):011:0> class FooBar irb(main):012:1> def rebaz irb(main):013:2> eval("class FooBar\ndef baz\nputs 'foobar:rebaz'\nend\nend") irb(main):014:2> end irb(main):015:1> end nil irb(main):016:0> f.rebaz nil So far nothing seems amiss. Instead of doing eval from main script, wrote rebaz method to do eval as instance method. irb(main):017:0> f.baz foobar:new baz nil Sigh. After calling #rebaz which I thought would have changed #baz, #baz still acts the same-- even though, except for scope/context, the eval statement was the same exact statement as I used before, where #baz did change. How can I write an instance method that will get the eval done the way I thought it was going to work? I don't want to eval dependent on FooBar class, the eval might want to change a method in Gizmo or Widget class instead. Eval just needs to happen from FooBar since that is the class that will have the method to handle evaluation of new code. Any suggestions? Thanks for your help. -michael ++++++++++++++++++++++++++++++++++++++++++ Michael C. Libby <x / ichimunki.com> public key: http://www.ichimunki.com/public_key.txt web site: http://www.ichimunki.com ++++++++++++++++++++++++++++++++++++++++++ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9Z3nJ4ClW9KMwqnMRAu+DAJ0UVhPhC+2ktbQvJqvF7dxkTsE+sQCgjXP8 c1WPg3E6Dq+zvCmT+vjtLX8= =pRaa -----END PGP SIGNATURE-----