Class | Ezamar::Template |
In: |
lib/ezamar/engine.rb
|
Parent: | Object |
Take a template (anything that responds to ::to_str) and options. At the moment the only option used is :file, which is used to tell Kernel::eval how to produce better backtraces.
All ye who seek magic, look elsewhere, this method is ASAP (as simple as possible)
There are some simple gsubs that build a final template which is evaluated
The rules are following: <?r rubycode ?>
evaluate the code inside the tag, this is considered XHTML-valid and so is the preferred method for executing code inside your templates. The return-value is ignored
<% rubycode %>
The same as <?r ?>, ERB-style and not valid XHTML, but should give someone who is already familiar with ERB some common ground
#{ rubycode }
You know this from normal ruby already and it's actually nothing else. Interpolation at the position in the template, isn't any special taggy format and therefor safe to use.
<%= rubycode %>
The result of this will be interpolated at the position in the template. Not valid XHTML either.
TODO
- provide C version or maybe use erbuis