class Malt::Engine::Mustache

Mustache engine.

@see github.com/defunkt/mustache

Public Instance Methods

render(params={}, &content) click to toggle source
# File lib/malt/engines/mustache.rb, line 14
def render(params={}, &content) #file, db, &content)
  text, scope, locals = parameters(params, :text, :scope, :locals)

  locals = make_hash(scope, locals, &content)

  # convert symbol keys to strings w/o rewriting the hash
  symbol_keys = locals.keys.select{ |k| Symbol === k }
  symbol_keys.each do |k|
    locals[k.to_s] = locals[k]
    locals.delete(k)
  end

  #engine = intermediate(params)
  #engine.render(data)

  ::Mustache.render(text, locals)
end

Private Instance Methods

require_engine() click to toggle source

Load rdoc makup library if not already loaded.

# File lib/malt/engines/mustache.rb, line 41
def require_engine
  return if defined? ::Mustache
  require_library 'mustache'
end