class JsonFileWriter

Public Instance Methods

write_enumerable(file, array) click to toggle source
# File lib/asciinema/json_file_writer.rb, line 3
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