Actions
Feature #1591
closedDATA handle unusable in required modules
Description
=begin
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.
=end
Actions
Like0
Like0Like0Like0Like0Like0