Ruby DATA
caiustheory.com
caiustheory.com
my @lines = <DATA>;
for (@lines) {
print if /bad/;
}
__DATA__
some good data
some bad data
more good data
more good dataThese are called Special Literals - http://perldoc.perl.org/perldata.html#Special-Literals
__LINE__ $?LINE
__FILE__ $?FILE
__PACKAGE__ $?PACKAGE
__END__ =begin END
__DATA__ =begin DATA
ref: http://feather.perl6.nl/syn/S02.html#Double-underscore_forms 10 DATA 1,2,3,4,5,6,7,8,9
20 FOR I=1 TO 9
30 READ A(I)
40 NEXT Ihttps://github.com/sinatra/sinatra/blob/master/lib/sinatra/b...
I suspect the reason it does so is for the point the author of the article makes briefly: "And it only exists for the first ruby file to be invoked by the interpreter."
To do that I wrote some code that parses a __DATA__ block for lines like:
mkdir foo create_file foo/bar.txt <<EOF .. This is the file content .. EOF mkdir bar ..
The process was very simple and allowed me to bundle up the "master template" files in one simple to understand resource.
[1] - https://github.com/skx/templer [2] - https://raw.github.com/skx/templer/master/lib/Templer/Site/N...