The __END__
keyword tells Ruby where a file ends – but you don't have to stop there. Any text you add after it is accessible via the DATA
object.
The attached example file data.rb
looks like this:
puts DATA.read
__END__
DATA is a File object to everything in the current file after "__END__"
Running it with ruby data.rb
prints:
DATA is a File object to everything in the current file after "__END__"
Posted by Dominik Schöler to makandra dev (2012-10-11 18:33)