lib/json-write-stream/stateful.rb in json-write-stream-1.0.1 vs lib/json-write-stream/stateful.rb in json-write-stream-1.0.2
- old
+ new
@@ -60,20 +60,25 @@
else
raise NotInArrayError, 'not currently writing an array.'
end
end
- def close
+ def flush
until stack.empty?
if in_object?
close_object
else
close_array
end
end
- stream.close
@closed = true
+ nil
+ end
+
+ def close
+ flush
+ stream.close
nil
end
def in_object?
current ? current.is_object? : false