From: wys@... (Clemens Wyss) Date: 2001-02-25T04:40:03+09:00 Subject: [ruby-talk:11475] eval-context problem (bug?) Hi all, the following code (part of this is from "Programming Ruby"): >>>> content = ' class Module @@docs = Hash.new(nil) def doc(str) @@docs[self.name] = str end def Module::doc(aClass) aClass = aClass.name if aClass.type <= Module @@docs[aClass] || "No documentation for #{aClass}" end end class Example doc ("This is a sample documentation string") # # .. rest of class end puts Module::doc(Example) ' class Test def getBinding return binding end end #eval(content) # works as expected eval(content, Test.new.getBinding()) # fails <<<<< Produces the following error: D:\Projekte\rubychannel\ProgrammingRuby\html\test.rb:34:in `eval': (eval):15:in `getBinding': undefined method `doc' for Test::Example:Class (NameError) from D:\Projekte\rubychannel\ProgrammingRuby\html\test.rb:34 This does not happen when eval-uating in the default-(i.e. main-)context. Is this a bug or an executing context related feature? Clemens