Class: Sie::Document::Renderer

Inherits:
Object
  • Object
show all
Defined in:
lib/sie/document/renderer.rb

Constant Summary collapse

ENCODING =
Encoding::CP437

Instance Method Summary collapse

Constructor Details

#initializeRenderer



6
7
8
9
# File 'lib/sie/document/renderer.rb', line 6

def initialize
  @io = StringIO.new
  @io.set_encoding(ENCODING)
end

Instance Method Details

#add_arrayObject



15
16
17
18
19
# File 'lib/sie/document/renderer.rb', line 15

def add_array
  append "{"
  yield
  append "}"
end

#add_line(label, *values) ⇒ Object



11
12
13
# File 'lib/sie/document/renderer.rb', line 11

def add_line(label, *values)
  append ["##{ label }", *format_values(values)].join(" ")
end

#renderObject



21
22
23
24
# File 'lib/sie/document/renderer.rb', line 21

def render
  io.rewind
  io.read
end