From: Chris Davaz Date: 2009-06-09T10:24:40+09:00 Subject: [ruby-core:23766] [Bug #1591] DATA handle unusable in required modules Bug #1591: DATA handle unusable in required modules http://redmine.ruby-lang.org/issues/show/1591 Author: Chris Davaz Status: Open, Priority: Normal Category: core ruby -v: ruby 1.9.1p129 (2009-05-12 revision 23412) [i686-linux] I have a Module defined in a file that gets required by a script. Inside the module I set a class variable: module MyModule class MyClass @@data = DATA.readlines def MyClass.getData return @@data end # ... end end __END__ lots of words ... DATA is undefined! If I add an __END__ section to the script that requires my module, DATA becomes defined and it contains the data in the script. Obviously the way this works makes DATA + __END__ useless except for the one case where a person wants to access __END__ data from within their own script. I would think the more common case would be a module requires a bunch of data and it is convenient to just put that at the end of the file that contains the module and load it up when it gets required. ---------------------------------------- http://redmine.ruby-lang.org