Class: Clamsy::Tenjin::ArrayBufferTemplate

Inherits:
Template
  • Object
show all
Defined in:
lib/clamsy/tenjin.rb

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>
{? for item in items ?}
  <li>#{item}</li>
{? 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

Instance Attribute Summary

Attributes inherited from Template

#args, #escapefunc, #filename, #initbuf, #newline, #script, #timestamp

Instance Method Summary collapse

Methods inherited from Template

#convert, #convert_file, #initialize, #render

Constructor Details

This class inherits a constructor from Clamsy::Tenjin::Template

Instance Method Details

#init_buf_exprObject

:nodoc:



752
753
754
# File 'lib/clamsy/tenjin.rb', line 752

def init_buf_expr()  # :nodoc:
  return "[]"
end