home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ruby164.zip / rbemx164.zip / ruby / share / doc / eruby-0.9.4 / README.en < prev    next >
Text File  |  2001-05-16  |  1KB  |  65 lines

  1. =begin
  2.  
  3. = README for eRuby
  4.  
  5. == What's eRuby?
  6.  
  7. eRuby interprets a Ruby code embedded text file. For example, eRuby
  8. enables you to embed a Ruby code to a HTML file.
  9.  
  10. == Required environment
  11.  
  12. * Ruby version 1.6.x or later.
  13.  
  14. == Installation
  15.  
  16. (1) Type `./configure.rb' to create Makefile.
  17.     (Type `./configure.rb --help' to get a help message.)
  18.  
  19. (2) Type `make' to compile eRuby.
  20.  
  21. (3) Type `make install' to install all files.
  22.  
  23. == Syntax
  24.  
  25. A Ruby block starts with `<%' and ends with `%>'. eRuby replaces
  26. the block with its output.
  27.  
  28.   $ cat foo
  29.   Hello, <% print "World!" %>
  30.   $ eruby foo
  31.   Hello, World!
  32.  
  33. If `<%' is followed by `=', eRuby replaces the block with a value
  34. of the block.
  35.  
  36.   $ cat bar
  37.   Hello, <%= "World!" %>
  38.   $ eruby bar
  39.   Hello, World!
  40.  
  41. If `<%' is followed by `#', the block is ignored as a comment.
  42.  
  43.   $ cat baz
  44.   Hello,<%# this is
  45.   a comment %> World!
  46.   $ eruby baz
  47.   Hello, World!
  48.  
  49. If a line starts with '%', eRuby evaluates the line as a Ruby
  50. program and replaces the line with its output.
  51.  
  52.   $ cat quux
  53.   % x = 1 + 1
  54.   1 + 1 = <%= x %>
  55.   $ eruby quux
  56.   1 + 1 = 2
  57.  
  58. =end
  59.  
  60. Local variables:
  61. mode: indented-text
  62. mode: auto-fill
  63. fill-column: 70
  64. End:
  65.