Module: Grass::Render

Included in:
Source
Defined in:
lib/grass/render.rb,
lib/grass/render/page.rb,
lib/grass/render/text.rb,
lib/grass/render/view.rb,
lib/grass/render/layout.rb,
lib/grass/render/script.rb,
lib/grass/render/renderer.rb,
lib/grass/render/stylesheet.rb,
lib/grass/render/yui_renderer.rb

Defined Under Namespace

Modules: Renderer, YuiRenderer Classes: Layout, Page, Script, Stylesheet, Text, View

Instance Method Summary collapse

Instance Method Details

#commit!(result = nil) ⇒ Object



19
20
21
22
23
# File 'lib/grass/render.rb', line 19

def commit! result = nil
  self.result = result || (self.type =~ /script|stylesheet/ ? self.render : self.raw)
  self.save!
  self
end

#render(data = {}) ⇒ Object



12
13
14
15
16
17
# File 'lib/grass/render.rb', line 12

def render data = {}
  @data = data
  result = "grass/render/#{self.type}".classify.constantize.new(self,@data).render
  commit! result if self.type == "page"
  result
end