class Malt::Engine::Erubis
Erubis
template implementation.
http://www.kuwata-lab.com/erubis/
Erubis
is essentially compatibel with ERB, but it is faster.
Constants
- ENGINE_OPTION_NAMES
Public Instance Methods
create_engine(params={})
click to toggle source
# File lib/malt/engines/erubis.rb, line 33 def create_engine(params={}) text, file, esc = parameters(params, :text, :file, :escape_html) opts = engine_options(params) cached(text, file, esc, opts) do if esc ::Erubis::EscapedEruby.new(text, opts) else ::Erubis::Eruby.new(text, opts) end end end
render(params, &content)
click to toggle source
Render template.
# File lib/malt/engines/erubis.rb, line 16 def render(params, &content) text, file, scope, locals = parameters(params, :text, :file, :scope, :locals) # NOTE: Erubis can handle hash data via result(:list=>data). # Would it be better to use that? bind = make_binding(scope, locals, &content) prepare_engine(params).result(bind) end
Private Instance Methods
engine_option_names()
click to toggle source
# File lib/malt/engines/erubis.rb, line 68 def engine_option_names ENGINE_OPTION_NAMES end
require_engine()
click to toggle source
Load ERB library if not already loaded.
# File lib/malt/engines/erubis.rb, line 59 def require_engine return if defined? ::Erubius require_library('erubis') end