Class: Malt::Engine::Ruby

Inherits:
Abstract show all
Defined in:
lib/malt/engines/ruby.rb

Overview

TODO:

deprecate ?

Ruby return reuslt as template engine.

Instance Attribute Summary

Attributes inherited from Abstract

#settings

Instance Method Summary collapse

Methods inherited from Abstract

#cache?, #create_engine, default, #initialize, #prepare_engine, register, type

Constructor Details

This class inherits a constructor from Malt::Engine::Abstract

Instance Method Details

#compile(params) ⇒ Object

Ruby compiles to Ruby. How odd. ;)



24
25
26
# File 'lib/malt/engines/ruby.rb', line 24

def compile(params)
  params[:text] #file
end

#render(params = {}, &content) ⇒ Object



16
17
18
19
20
21
# File 'lib/malt/engines/ruby.rb', line 16

def render(params={}, &content)
  text, file, scope, locals = parameters(params, :text, :file, :scope, :locals)

  bind = make_binding(scope, locals, &content)
  eval(text, bind, file || 'eval')
end