Class: Malt::Engines::Ruby

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

Overview

Ruby as a template engine.

http://

Instance Attribute Summary

Attributes inherited from Abstract

#settings

Instance Method Summary collapse

Methods inherited from Abstract

#cache?, default, #initialize, register

Constructor Details

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

Instance Method Details

#compile(text, file) ⇒ Object

Ruby compiles to Ruby. How odd. ;)



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

def compile(text, file)
  text
end

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



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

def render(params={}, &yld)
  text = params[:text]
  file = params[:file]
  data = params[:data]
  data = make_binding(data, &yld)
  eval(text, data, file)
end