From d366843d7d75d632f6dcf54da8cb19cd2ecff288 Mon Sep 17 00:00:00 2001 From: gilberthappi Date: Thu, 30 Nov 2023 19:20:47 +0200 Subject: [PATCH] Adding files for game_author_preserve --- app.rb | 2 +- data/author.json | 2 ++ data/game.json | 1 + main.rb | 4 ++-- 4 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 data/author.json create mode 100644 data/game.json diff --git a/app.rb b/app.rb index 55db96c..fbfa1bc 100644 --- a/app.rb +++ b/app.rb @@ -2,7 +2,7 @@ require_relative 'classes/author' class App - attr_accessor :game, :author + attr_accessor :games, :authors def initialize @games = [] diff --git a/data/author.json b/data/author.json new file mode 100644 index 0000000..4ef9786 --- /dev/null +++ b/data/author.json @@ -0,0 +1,2 @@ +[{"first_name":"happi","last_name":"Gilbert"}, +{"first_name":"Ivonne","last_name":"Friend"}] \ No newline at end of file diff --git a/data/game.json b/data/game.json new file mode 100644 index 0000000..fcc958f --- /dev/null +++ b/data/game.json @@ -0,0 +1 @@ +[{"publish_date":"2023-01-02","multiplayer":true,"last_played_at":"2023-10-10"}] \ No newline at end of file diff --git a/main.rb b/main.rb index 1acc2ab..d87e9a7 100644 --- a/main.rb +++ b/main.rb @@ -16,7 +16,7 @@ def main puts '8. Add a music album' puts '9. Add a game' puts '10. Add an author' - puts '11. Exit' + puts '11. Save and Exit' options = gets.chomp.to_i @@ -42,7 +42,7 @@ def main when 10 app.add_author when 11 - puts 'Thanks for using Catalog of my things app!' + app.save_data break else puts 'Invalid option. Please try again.'