Feature #1591
DATA handle unusable in required modules
| Status: | Assigned | Start date: | 06/09/2009 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | - | |||
| Target version: | - |
Description
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.
History
Updated by Nobuyoshi Nakada over 2 years ago
- Category set to core
- Assignee set to Yukihiro Matsumoto
- Target version set to 3.0
Updated by Shyouhei Urabe over 1 year ago
- Status changed from Open to Assigned
Updated by Yui NARUSE 4 months ago
- Project changed from ruby-trunk to 14
- Category deleted (
core) - Target version deleted (
3.0)
Updated by Yui NARUSE 4 months ago
- Project changed from 14 to ruby-trunk