Trying to teach myself some metaprogramming and have been sifting
through the rails source. I often see:
module_eval << -end_eval
stuff to add
end_eval
I understand what this does, but I'm curious what part of the language
the -end_eval construct is coming from.
Thanks,
Brad
···
--
Posted via http://www.ruby-forum.com/.
module_eval <<-EOS
string-of-stuff-to-add
EOS
It's what's called a heredoc.
-austin
···
On 6/26/06, Brad Chase <bachase@gmail.com> wrote:
Trying to teach myself some metaprogramming and have been sifting
through the rails source. I often see:
module_eval << -end_eval
stuff to add
end_eval
I understand what this does, but I'm curious what part of the language
the -end_eval construct is coming from.
--
Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/
* austin@halostatue.ca * http://www.halostatue.ca/feed/
* austin@zieglers.ca
it's the same as print << -HERE
HERE
the - means HERE does not have to be the first part of the line and can be indented
Brad Chase wrote:
···
Trying to teach myself some metaprogramming and have been sifting through the rails source. I often see:
module_eval << -end_eval
stuff to add
end_eval
I understand what this does, but I'm curious what part of the language the -end_eval construct is coming from.
Thanks,
Brad