Module: FunHtml::Writer

Includes:
Kernel
Included in:
Template
Defined in:
lib/fun_html/writer.rb

Overview

Writer collects the rendered elements and attributes into a string.

Instance Method Summary collapse

Instance Method Details

#initializeObject



12
13
14
# File 'lib/fun_html/writer.rb', line 12

def initialize
  @__buffer = +''
end

#renderObject

Render produces the HTML string and clears the buffer.



17
18
19
20
21
22
# File 'lib/fun_html/writer.rb', line 17

def render
  @__buffer
ensure
  # empty the buffer to prevent double rendering
  @__buffer = +''
end