def write_file(file_name, file_contents)
      contents =  file_contents
                  .flatten
                  .select { |line| line }
                  .join("\n")
      File.open(file_name, "w") do |fh|
        fh.write(contents)
        fh.write("\n")
      end
    end
def write_file(file_name, file_contents)
      contents =  file_contents
                  .flatten
                  .select { |line| line }
                  .join("\n")
      File.open(file_name, "w") do |fh|
        fh.write(contents)
        fh.write("\n")
      end
    end
Write an array of strings to a file, adding newline separators, and
 ensuring a trailing newline at the end of a file.