Method: StudioGame::Game#save_high_scores

Defined in:
lib/game_class.rb

#save_high_scores(to_file = "high_scores.txt") ⇒ Object



38
39
40
41
42
43
44
45
46
# File 'lib/game_class.rb', line 38

def save_high_scores(to_file="high_scores.txt")
  File.open(to_file, "w") do |file|
    file.puts Time.new.strftime("File updated/created on %m/%d/%Y at %I:%M %p.") #me printing the time!
    file.puts "\n#{@title} High Scores:"
    @players.sort.each do |player|
      file.puts high_score_entry(player)
    end
  end
end