Class: AnyData
- Inherits:
-
File
- Object
- File
- AnyData
- Defined in:
- lib/any_data.rb
Defined Under Namespace
Classes: NoDataError
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path = (caller.first.split(':').first)) ⇒ AnyData
constructor
Open the given file, or the file of the caller, and scans to __END__.
Constructor Details
#initialize(path = (caller.first.split(':').first)) ⇒ AnyData
Open the given file, or the file of the caller, and scans to __END__. This is very similar to the manner in which DATA works for $0. Can raise an AnyData::NoDataError if EOF is reached before finding __END__.
15 16 17 18 19 20 |
# File 'lib/any_data.rb', line 15 def initialize(path = (caller.first.split(':').first)) super(path, 'r') line = readline until line =~ /^__END__$/ rescue EOFError raise NoDataError, file end |
Class Method Details
.version ⇒ Object
2 |
# File 'lib/any_data.rb', line 2 def self.version; '0.1.2'; end |