Class: NanoTemplate
- Inherits:
-
Object
- Object
- NanoTemplate
- Defined in:
- lib/nano_template.rb
Overview
text template like erb
Defined Under Namespace
Classes: TemplateCompileError
Instance Method Summary collapse
-
#template(value) ⇒ Proc
build template.
Instance Method Details
#template(value) ⇒ Proc
build template
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/nano_template.rb', line 8 def template(value) begin sub = build_template(value) Proc.new do |stash| stash.instance_eval &sub end rescue => error raise "template compile error:\n#{error}\n--\n#{value}" end end |