Permalink
Browse files

Add info to README on file -> implementation mappings

  • Loading branch information...
1 parent 8752db2 commit 067ea31bfcb2e226d33d1236fb3a7537c87b2b9d @rtomayko rtomayko committed Feb 11, 2009
Showing with 13 additions and 0 deletions.
  1. +13 −0 README.md
View
@@ -60,3 +60,16 @@ The block passed to the `render` method is invoked on `yield`:
template = Tilt::ERBTemplate.new('foo.erb')
template.render { 'Joe' }
# => "Hey Joe!"
+
+There's also a lightweight file extension to template engine mapping layer.
+You can pass a filename or extension to `Tilt::[]` to retrieve the
+corresponding implementation class:
+
+ Tilt['hello.erb']
+ # => Tilt::ERBTemplate
+
+The `Tilt.new` works similarly but returns a new instance of the underlying
+implementation class:
+
+ template = Tilt.new('templates/foo.erb')
+ output = template.render

0 comments on commit 067ea31

Please sign in to comment.