gemillionaire 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a574900ac1e6abd630e64121b6213a95cfc2fc4116414abbf861d7a12730307
4
- data.tar.gz: b1a9c501873c63930b7904dde921ee1abb34d93ac77701059cad9ffd49a70d93
3
+ metadata.gz: 2a0d866de6a4bcd45b10008c1683ec9ae7a323684a7046099aa009e25e4a1bf3
4
+ data.tar.gz: 44e42eb68cbfca9657e09bbc8095489fb19a3cad3220da73cd4d095e847c3fb9
5
5
  SHA512:
6
- metadata.gz: 18951f698767e0f58a8cff4e038bcf6ab9dda4daad7a1ff01d7e797b16fdf9a89e818c8b19e2ec4ad144df28657e95a3de69c9df677d4346c93fa820c9acb041
7
- data.tar.gz: 15200b97f1205146b92bcd32b17db7bddd8e9a798f4a492ccb07735deff54fa36f282f93452ab77caf38a58ed8f7fef5136b28ba629ba853dc054b85f90a95d4
6
+ metadata.gz: 828d8d95ec1f791ae665cac6584fd5fb2e2314ccf6938e872e30e4a438239fd3374a510e5f4b7dd65332946f422e09f8a89bf4b52bbd96335aeec68a778a6702
7
+ data.tar.gz: f8b5409ffc59032630ca3c69be1582d0880b0185d4055916379b2c901299c0c67da8d57b813eb610a3b432e5edccf161ab2dabf6fcbb85aef59614a1718446fc
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'app'
3
+ require_relative 'gemillionaire/app'
4
4
 
5
5
  app = App.new
6
6
  app.menu
@@ -14,8 +14,8 @@ class App
14
14
 
15
15
  def initialize
16
16
  check_dependencies
17
- @questions = JSON.parse(File.read('./questions.json'))
18
- @statistics = JSON.parse(File.read('./hiscores.json'))
17
+ @questions = JSON.parse(File.read('lib/gemillionaire/questions.json'))
18
+ @statistics = JSON.parse(File.read('lib/gemillionaire/hiscores.json'))
19
19
  @prizes = ['0', '500', '1,000', '2,000', '3,000', '5,000', '7,500', '10,000', '12,500', '15,000',
20
20
  '25,000', '50,000', '100,000', '250,000', '500,000', '1,000,000'].freeze
21
21
  @main_menu = [
@@ -32,10 +32,10 @@ class App
32
32
  end
33
33
 
34
34
  def check_dependencies
35
- missing_file = 'app.rb' unless File.exist?('./app.rb')
36
- missing_file = 'game.rb' unless File.exist?('./game.rb')
37
- missing_file = 'hiscores.json' unless File.exist?('./hiscores.json')
38
- missing_file = 'questions.json' unless File.exist?('./questions.json')
35
+ missing_file = 'app.rb' unless File.exist?('lib/gemillionaire/app.rb')
36
+ missing_file = 'game.rb' unless File.exist?('lib/gemillionaire/game.rb')
37
+ missing_file = 'hiscores.json' unless File.exist?('lib/gemillionaire/hiscores.json')
38
+ missing_file = 'questions.json' unless File.exist?('lib/gemillionaire/questions.json')
39
39
  return unless missing_file
40
40
 
41
41
  puts 'Missing File Error'.bold.red
@@ -79,7 +79,7 @@ class App
79
79
  end
80
80
 
81
81
  def run_hiscores
82
- @statistics = JSON.parse(File.read('./hiscores.json'))
82
+ @statistics = JSON.parse(File.read('lib/gemillionaire/hiscores.json'))
83
83
  games_played = @statistics['games_played'].to_i
84
84
  total_winnings = @statistics['total_winnings'].to_i
85
85
  average_earnings = games_played.zero? ? 0 : total_winnings / games_played
@@ -96,4 +96,4 @@ class App
96
96
  end
97
97
  end
98
98
 
99
- require_relative 'game'
99
+ require 'gemillionaire/game'
@@ -120,7 +120,7 @@ class Game < App
120
120
  @statistics['games_played'] = @statistics['games_played'].to_i + 1
121
121
  @statistics['total_winnings'] = @statistics['total_winnings'].to_i + prize
122
122
  @statistics['hiscore'] = prize if prize > @statistics['hiscore'].to_i
123
- File.write('./hiscores.json', JSON.dump(@statistics))
123
+ File.write('lib/gemillionaire/hiscores.json', JSON.dump(@statistics))
124
124
  any_key
125
125
  end
126
126
 
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemillionaire
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Sterling
@@ -16,11 +16,11 @@ executables: []
16
16
  extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
- - "./app.rb"
20
- - "./game.rb"
21
- - "./gemillionaire.rb"
22
- - "./hiscores.json"
23
- - "./questions.json"
19
+ - lib/gemillionaire.rb
20
+ - lib/gemillionaire/app.rb
21
+ - lib/gemillionaire/game.rb
22
+ - lib/gemillionaire/hiscores.json
23
+ - lib/gemillionaire/questions.json
24
24
  homepage: https://rubygems.org/gems/gemillionaire
25
25
  licenses:
26
26
  - MIT