lib/sie/document/renderer.rb in sie-2.2.0 vs lib/sie/document/renderer.rb in sie-3.0.0
- old
+ new
@@ -1,9 +1,8 @@
require "stringio"
class Sie::Document::Renderer
- EMPTY_ARRAY = :empty_array
ENCODING = Encoding::CP437
def initialize
@io = StringIO.new
@io.set_encoding(ENCODING)
@@ -42,11 +41,12 @@
def format_value(value)
case value
when Date
value.strftime("%Y%m%d")
- when EMPTY_ARRAY
- "{}"
+ when Array
+ subvalues = value.map { |subvalue| format_value(subvalue.to_s) }
+ "{#{subvalues.join(' ')}}"
when Numeric
value.to_s
else
'"' + value.to_s.gsub('"', '\"') + '"'
end