Project

General

Profile

Actions

Feature #1591

closed

DATA handle unusable in required modules

Added by cdavaz (Chris Davaz) almost 15 years ago. Updated about 12 years ago.

Status:
Rejected
Target version:
-
[ruby-core:23766]

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

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0