Method: ChessData::Database#to_file

Defined in:
lib/chess_data/database.rb

#to_file(filename) ⇒ Object

Save the database in PGN format to given filename. If filename exists, the games are appended to the file.



64
65
66
67
68
69
70
71
# File 'lib/chess_data/database.rb', line 64

def to_file filename
  File.open(filename, "a") do |f|
    @games.each do |game|
      game.to_pgn f
      f.puts
    end
  end
end