Module: Pakada::Render::Rendering

Defined in:
lib/pakada/render/rendering.rb

Instance Method Summary collapse

Instance Method Details

#render(templates, locals = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/pakada/render/rendering.rb', line 3

def render(templates, locals = {})
  templates, engine = Array(templates), nil
  templates.each {|template|
    e = Pakada[:render].template_map[template.to_sym]
    engine = e if e
  }
  
  unless engine
    raise ArgumentError, "Unknown template #{templates.join(",")}"
  end
  
  Pakada.safety(Pakada::Render::Renderer).new engine, locals
end

#render!(template, locals = {}) ⇒ Object



17
18
19
# File 'lib/pakada/render/rendering.rb', line 17

def render!(template, locals = {})
  render(template, locals).to_s
end