Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

explain the dict style

  • Loading branch information...
commit 04e852b2445e0e12a4aa06bdd2f7d30003fc9b4a 1 parent 9d84116
@defunkt defunkt authored
Showing with 31 additions and 0 deletions.
  1. +31 −0 README.md
View
31 README.md
@@ -74,6 +74,37 @@ Which returns the following:
Simple.
+Dict-Style Views
+----------------
+
+ctemplate and friends want you to hand a dictionary to the template
+processor. Naturally rtemplate supports a similar concept. Feel free
+to mix the class-based and this more procedural style at your leisure.
+
+Given this template (dict.html):
+
+ Hello {{name}}
+ You have just won ${{value}}!
+
+We can fill in the values at will:
+
+ dict = Dict.new
+ dict[:name] = 'George'
+ dict[:value] = 100
+ dict.to_html
+
+Which returns:
+
+ Hello George
+ You have just won $100!
+
+We can re-use the same object, too:
+
+ dict[:name] = 'Tony'
+ dict.to_html
+ Hello Tony
+ You have just won $100!
+
Helpers
-------
Please sign in to comment.
Something went wrong with that request. Please try again.