Class: Tenjin::ArrayBufferTemplate
Overview
(experimental) fast template class which use Array buffer and Array#push()
ex. (‘foo.rb’)
require 'tenjin'
engine = Tenjin::Engine.new(:templateclass=>Tenjin::ArrayBufferTemplate)
template = engine.get_template('foo.rbhtml')
puts template.script
result:
$ cat foo.rbhtml
<ul>
<?rb for item in items ?>
<li>#{item}</li>
<?rb end ?>
</ul>
$ ruby foo.rb
_buf.push('<ul>
'); for item in items
_buf.push(' <li>', (item).to_s, '</li>
'); end
_buf.push('</ul>
');
Constant Summary
Constants inherited from Template
Template::ESCAPE_FUNCTION, Template::TRACE
Instance Attribute Summary
Attributes inherited from Template
#_last_checked_at, #args, #escapefunc, #filename, #initbuf, #newline, #script, #timestamp
Instance Method Summary collapse
-
#finish_buf_expr ⇒ Object
:nodoc:.
-
#init_buf_expr ⇒ Object
:nodoc:.
Methods inherited from Template
TRACE=, #convert, #convert_file, #initialize, #render
Constructor Details
This class inherits a constructor from Tenjin::Template
Instance Method Details
#finish_buf_expr ⇒ Object
:nodoc:
935 936 937 |
# File 'lib/tenjin.rb', line 935 def finish_buf_expr() # :nodoc: return "_buf.join" end |
#init_buf_expr ⇒ Object
:nodoc:
931 932 933 |
# File 'lib/tenjin.rb', line 931 def init_buf_expr() # :nodoc: return "[]" end |