Class: Sie::Document::Renderer
- Inherits:
-
Object
- Object
- Sie::Document::Renderer
- Defined in:
- lib/sie/document/renderer.rb
Constant Summary collapse
- ENCODING =
Encoding::CP437
Instance Method Summary collapse
- #add_array ⇒ Object
- #add_line(label, *values) ⇒ Object
-
#initialize ⇒ Renderer
constructor
A new instance of Renderer.
- #render ⇒ Object
Constructor Details
#initialize ⇒ Renderer
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_array ⇒ Object
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 |
#render ⇒ Object
21 22 23 24 |
# File 'lib/sie/document/renderer.rb', line 21 def render io.rewind io.read end |