asciinema.org/app/services/json_file_writer.rb
2013-09-10 21:29:17 +02:00

22 lines
274 B
Ruby

class JsonFileWriter
def write_enumerable(file, array)
first = true
file << '['
array.each do |item|
if first
first = false
else
file << ','
end
file << item.to_json
end
file << ']'
file.close
end
end