icodebreaker_gem 0.3.4 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -1
- data/lib/game_core.rb +1 -0
- data/lib/icodebreaker_gem/version.rb +1 -1
- data/lib/icodebreaker_gem.rb +1 -1
- data/lib/modules/storage.rb +5 -6
- data/lib/modules/validation.rb +9 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f16ded1e988830364267df7d10ab98c2ecd19f22f52b72e0ddfd2a755be43ef7
|
4
|
+
data.tar.gz: 6f9207560467e19928cc219757878c2c017931d28e4e9f892e40e572c2ff7664
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 311277b318ee91cbc013a7fd62bd954a50b5b5e0e87946196e61cd63e397f197af9cfba65f1f29bd2c4be29e5f5b646972f0c7ace3d690cac0efd03a62f5479c
|
7
|
+
data.tar.gz: 6afa91a2abcd786f3e5f3f9a759ddeb8fd5fdf1e96e420ea6599a69b34cc1aa02a911a82a13ef455c77d2c1969e418838b0ead83e14e53550cf1de0d6ae15935
|
data/Gemfile.lock
CHANGED
data/lib/game_core.rb
CHANGED
data/lib/icodebreaker_gem.rb
CHANGED
data/lib/modules/storage.rb
CHANGED
@@ -4,21 +4,20 @@ module IcodebreakerGem
|
|
4
4
|
module Storage
|
5
5
|
DATA_FILE = 'codebreakers.yml'
|
6
6
|
STORAGE_PATH = './storage/'
|
7
|
-
|
7
|
+
|
8
8
|
class << self
|
9
|
-
|
10
|
-
def save_storage
|
9
|
+
def save_storage(game)
|
11
10
|
create_storage
|
12
11
|
games = load_storage
|
13
|
-
games <<
|
12
|
+
games << game
|
14
13
|
File.open(data_path, 'w') do |file|
|
15
14
|
YAML.dump(games, file)
|
16
15
|
end
|
17
|
-
|
18
16
|
end
|
17
|
+
|
19
18
|
def load_storage
|
20
19
|
create_storage
|
21
|
-
YAML.
|
20
|
+
YAML.load(File.read(data_path)) || []
|
22
21
|
end
|
23
22
|
|
24
23
|
def sort_codebreakers
|
data/lib/modules/validation.rb
CHANGED
@@ -6,15 +6,21 @@ module IcodebreakerGem
|
|
6
6
|
CODE = /^[1-6]{4}$/.freeze
|
7
7
|
|
8
8
|
def validate_name(name)
|
9
|
-
|
9
|
+
return unless name.to_s.match?(USERNAME)
|
10
|
+
|
11
|
+
true
|
10
12
|
end
|
11
13
|
|
12
14
|
def validate_code(code)
|
13
|
-
|
15
|
+
return unless code.to_s.match?(CODE)
|
16
|
+
|
17
|
+
true
|
14
18
|
end
|
15
19
|
|
16
20
|
def validate_difficulty(difficulty)
|
17
|
-
|
21
|
+
return unless %i[easy medium hell].include? difficulty.to_s.to_sym
|
22
|
+
|
23
|
+
true
|
18
24
|
end
|
19
25
|
end
|
20
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: icodebreaker_gem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JohnnyGsy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0'
|
160
160
|
requirements: []
|
161
|
-
rubygems_version: 3.2
|
161
|
+
rubygems_version: 3.1.2
|
162
162
|
signing_key:
|
163
163
|
specification_version: 4
|
164
164
|
summary: The codebreaker game.
|