Module: Garterbelt::ContentRendering::InstanceMethods

Defined in:
lib/renderers/content_rendering.rb

Instance Method Summary collapse

Instance Method Details

#footObject



28
29
30
31
32
# File 'lib/renderers/content_rendering.rb', line 28

def foot
  view.render_style = view_style
  view._escape = view_escape
  view._level -= 1
end

#headObject



19
20
21
22
23
24
25
26
# File 'lib/renderers/content_rendering.rb', line 19

def head
  self.view_style = view.render_style
  self.view_escape = view._escape
  
  view.render_style = style
  view._escape = escape
  view._level += 1
end

#raise_unless_block_contentObject

Raises:

  • (ArgumentError)


43
44
45
# File 'lib/renderers/content_rendering.rb', line 43

def raise_unless_block_content
  raise ArgumentError, "Block content required" unless self.content && self.content.is_a?(Proc)
end

#renderObject



12
13
14
15
16
17
# File 'lib/renderers/content_rendering.rb', line 12

def render
  head
  render_content
  foot
  output
end

#render_contentObject



34
35
36
37
38
39
40
41
# File 'lib/renderers/content_rendering.rb', line 34

def render_content
  if content.is_a?(Proc)
    content.call
  else
    view._buffer << Text.new(:view => view, :content => content) if content
  end
  view.render_buffer
end