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 +4 -4
- data/{gemillionaire.rb → lib/gemillionaire.rb} +1 -1
- data/{app.rb → lib/gemillionaire/app.rb} +8 -8
- data/{game.rb → lib/gemillionaire/game.rb} +1 -1
- data/{hiscores.json → lib/gemillionaire/hiscores.json} +0 -0
- data/{questions.json → lib/gemillionaire/questions.json} +0 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a0d866de6a4bcd45b10008c1683ec9ae7a323684a7046099aa009e25e4a1bf3
|
4
|
+
data.tar.gz: 44e42eb68cbfca9657e09bbc8095489fb19a3cad3220da73cd4d095e847c3fb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 828d8d95ec1f791ae665cac6584fd5fb2e2314ccf6938e872e30e4a438239fd3374a510e5f4b7dd65332946f422e09f8a89bf4b52bbd96335aeec68a778a6702
|
7
|
+
data.tar.gz: f8b5409ffc59032630ca3c69be1582d0880b0185d4055916379b2c901299c0c67da8d57b813eb610a3b432e5edccf161ab2dabf6fcbb85aef59614a1718446fc
|
@@ -14,8 +14,8 @@ class App
|
|
14
14
|
|
15
15
|
def initialize
|
16
16
|
check_dependencies
|
17
|
-
@questions = JSON.parse(File.read('
|
18
|
-
@statistics = JSON.parse(File.read('
|
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?('
|
36
|
-
missing_file = 'game.rb' unless File.exist?('
|
37
|
-
missing_file = 'hiscores.json' unless File.exist?('
|
38
|
-
missing_file = 'questions.json' unless File.exist?('
|
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('
|
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
|
-
|
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('
|
123
|
+
File.write('lib/gemillionaire/hiscores.json', JSON.dump(@statistics))
|
124
124
|
any_key
|
125
125
|
end
|
126
126
|
|
File without changes
|
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.
|
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
|
-
-
|
20
|
-
-
|
21
|
-
-
|
22
|
-
-
|
23
|
-
-
|
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
|