Module: Grass::Render::Renderer

Includes:
Helpers::RenderHelper
Included in:
Layout, Page, Script, Text, View, YuiRenderer
Defined in:
lib/grass/render/renderer.rb

Instance Method Summary collapse

Methods included from Helpers::RenderHelper

#include_partial, #render_content, #render_partial

Instance Method Details

#initialize(source, data = {}) ⇒ Object



16
17
18
19
# File 'lib/grass/render/renderer.rb', line 16

def initialize source, data = {}
  @source = source
  @data = data
end

#renderObject



21
22
23
24
25
26
27
# File 'lib/grass/render/renderer.rb', line 21

def render 
  result = @source.raw
  templates.each do |template|
    result = template.new{result}.render(self,@data)
  end
  result
end

#templatesObject



29
30
31
# File 'lib/grass/render/renderer.rb', line 29

def templates 
  @templates ||= Tilt.templates_for(@source.handler || @source.format)
end