icodebreaker_gem 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec_status +20 -20
- data/Gemfile.lock +1 -1
- data/lib/icodebreaker_gem/version.rb +1 -1
- data/lib/modules/storage.rb +17 -16
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 042dbedd8e000d620a90aa17a91afc3f08bd64e486e7e06df12a409919503d57
|
4
|
+
data.tar.gz: 40b79540a1bb21afb573b0ae671bb7d9fb05ccd53e6d82f33287a961329106f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 600c4497bd0c6af0cb66ce0e6d26c8c4f8da62cb15b8b136ab4217676d8c74d137c904d7142c2077cec076e549b534d737cefb25c690d19a8c1db04132979642
|
7
|
+
data.tar.gz: 15f30eeb6037b8329fba8f12baeaadb1c6a10158ab14fa5dc17fdb697815149e0f0e724cd3b012df4afb019c7d581f7f20844153f628fd0b7f3e8d858fcde79b
|
data/.rspec_status
CHANGED
@@ -1,30 +1,30 @@
|
|
1
1
|
example_id | status | run_time |
|
2
2
|
------------------------------------ | ------ | --------------- |
|
3
|
-
./spec/game_core_spec.rb[1:1] | passed | 0.
|
4
|
-
./spec/game_core_spec.rb[1:2] | passed | 0.
|
5
|
-
./spec/game_core_spec.rb[1:3:1] | passed | 0.
|
6
|
-
./spec/game_core_spec.rb[1:4:1] | passed | 0.
|
7
|
-
./spec/game_core_spec.rb[1:5:1:1] | passed | 0.
|
3
|
+
./spec/game_core_spec.rb[1:1] | passed | 0.00023 seconds |
|
4
|
+
./spec/game_core_spec.rb[1:2] | passed | 0.00073 seconds |
|
5
|
+
./spec/game_core_spec.rb[1:3:1] | passed | 0.00034 seconds |
|
6
|
+
./spec/game_core_spec.rb[1:4:1] | passed | 0.00055 seconds |
|
7
|
+
./spec/game_core_spec.rb[1:5:1:1] | passed | 0.00008 seconds |
|
8
8
|
./spec/game_core_spec.rb[1:5:1:2] | passed | 0.0001 seconds |
|
9
|
-
./spec/game_core_spec.rb[1:5:1:3] | passed | 0.
|
10
|
-
./spec/game_core_spec.rb[1:5:1:4] | passed | 0.
|
9
|
+
./spec/game_core_spec.rb[1:5:1:3] | passed | 0.00008 seconds |
|
10
|
+
./spec/game_core_spec.rb[1:5:1:4] | passed | 0.0001 seconds |
|
11
11
|
./spec/game_core_spec.rb[1:5:1:5] | passed | 0.00005 seconds |
|
12
|
-
./spec/game_core_spec.rb[1:5:1:6] | passed | 0.
|
12
|
+
./spec/game_core_spec.rb[1:5:1:6] | passed | 0.00005 seconds |
|
13
13
|
./spec/game_core_spec.rb[1:5:1:7] | passed | 0.00004 seconds |
|
14
14
|
./spec/game_core_spec.rb[1:5:2:1] | passed | 0.00005 seconds |
|
15
15
|
./spec/game_core_spec.rb[1:5:2:2] | passed | 0.00005 seconds |
|
16
16
|
./spec/game_core_spec.rb[1:5:3:1] | passed | 0.00005 seconds |
|
17
|
-
./spec/game_core_spec.rb[1:5:3:2] | passed | 0.
|
18
|
-
./spec/game_core_spec.rb[1:5:3:3] | passed | 0.
|
19
|
-
./spec/game_spec.rb[1:1:1] | passed | 0.
|
17
|
+
./spec/game_core_spec.rb[1:5:3:2] | passed | 0.00005 seconds |
|
18
|
+
./spec/game_core_spec.rb[1:5:3:3] | passed | 0.00007 seconds |
|
19
|
+
./spec/game_spec.rb[1:1:1] | passed | 0.00013 seconds |
|
20
20
|
./spec/game_spec.rb[1:2:1] | passed | 0.00025 seconds |
|
21
|
-
./spec/game_spec.rb[1:2:2] | passed | 0.
|
22
|
-
./spec/game_spec.rb[1:2:3] | passed | 0.
|
23
|
-
./spec/game_spec.rb[1:2:4] | passed | 0.
|
24
|
-
./spec/game_spec.rb[1:2:5] | passed | 0.
|
25
|
-
./spec/game_spec.rb[1:3:1] | passed | 0.
|
26
|
-
./spec/game_spec.rb[1:3:2] | passed | 0.
|
21
|
+
./spec/game_spec.rb[1:2:2] | passed | 0.00006 seconds |
|
22
|
+
./spec/game_spec.rb[1:2:3] | passed | 0.00006 seconds |
|
23
|
+
./spec/game_spec.rb[1:2:4] | passed | 0.00006 seconds |
|
24
|
+
./spec/game_spec.rb[1:2:5] | passed | 0.00006 seconds |
|
25
|
+
./spec/game_spec.rb[1:3:1] | passed | 0.00039 seconds |
|
26
|
+
./spec/game_spec.rb[1:3:2] | passed | 0.00018 seconds |
|
27
27
|
./spec/game_spec.rb[1:3:3] | passed | 0.00014 seconds |
|
28
|
-
./spec/game_spec.rb[1:4:1] | passed | 0.
|
29
|
-
./spec/game_spec.rb[1:5:1] | passed | 0.
|
30
|
-
./spec/icodebreaker_gem_spec.rb[1:1] | passed | 0.
|
28
|
+
./spec/game_spec.rb[1:4:1] | passed | 0.00011 seconds |
|
29
|
+
./spec/game_spec.rb[1:5:1] | passed | 0.00112 seconds |
|
30
|
+
./spec/icodebreaker_gem_spec.rb[1:1] | passed | 0.00008 seconds |
|
data/Gemfile.lock
CHANGED
data/lib/modules/storage.rb
CHANGED
@@ -12,27 +12,28 @@ module IcodebreakerGem
|
|
12
12
|
YAML.dump(games, file)
|
13
13
|
end
|
14
14
|
end
|
15
|
+
class << self
|
16
|
+
def load_storage
|
17
|
+
create_storage
|
18
|
+
YAML.load(File.read(data_path)) || []
|
19
|
+
end
|
15
20
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
def sort_codebreakers
|
22
|
-
load_storage.sort_by do |statistic|
|
23
|
-
[statistic[:attempts_total], statistic[:attempts_used], statistic[:hints_used]]
|
21
|
+
def sort_codebreakers
|
22
|
+
load_storage.sort_by do |statistic|
|
23
|
+
[statistic[:attempts_total], statistic[:attempts_used], statistic[:hints_used]]
|
24
|
+
end
|
24
25
|
end
|
25
|
-
end
|
26
26
|
|
27
|
-
|
27
|
+
private
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
def data_path
|
30
|
+
STORAGE_PATH + DATA_FILE
|
31
|
+
end
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
def create_storage
|
34
|
+
Dir.mkdir(STORAGE_PATH) unless File.exist?(STORAGE_PATH)
|
35
|
+
File.open(data_path, 'w') unless File.exist?(data_path)
|
36
|
+
end
|
36
37
|
end
|
37
38
|
end
|
38
39
|
end
|