Minor correction (mostly because, I think the code is kinda interesting), Sinatra does something close to this. It actually uses the __END__ tag for its inline templates, but then internally it splits the file itself in two and then parses the latter portion:
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."
14 comments
[ 3.1 ms ] story [ 43.8 ms ] threadThese are called Special Literals - http://perldoc.perl.org/perldata.html#Special-Literals
https://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...