Download
HTTP
Subversion
<URL:http://svn.modruby.net/repos/eruby/>
To get the head of trunk, type the following command:
$ svn co http://svn.modruby.net/repos/eruby/trunk eruby
ViewCVS
at 2004-09-27 14:18 / permalink
Syntax of eRuby
A Ruby block starts with `<%' and ends with `%>'. eRuby replaces the block with its output.
$ cat foo Hello, <% print "World!" %> $ eruby foo Hello, World!
If `<%' is followed by `=', eRuby replaces the block with a value of the block.
$ cat bar Hello, <%= "World!" %> $ eruby bar Hello, World!
If `<%' is followed by `#', the block is ignored as a comment.
$ cat baz Hello,<%# this is a comment %> World! $ eruby baz Hello, World!
If a line starts with '%', eRuby evaluates the line as a Ruby program and replaces the line with its output.
$ cat quux % x = 1 + 1 1 + 1 = <%= x %> $ eruby quux 1 + 1 = 2
at 2004-07-07 16:45 / permalink
What's eruby?
eruby is an implementation of eRuby by C.
eRuby is a language to embed Ruby codes into text files. For example, you can embed Ruby codes into HTML files.
at 2004-07-07 15:55 / permalink