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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b2c433d4d680d34546db1dd48696176293335553fd1de88c7c282712f89bd43
4
- data.tar.gz: 0ca9ab3534dc7e92c0cd5fe7aad427c2fdda33e8c2a7223d759cb0724b9617ce
3
+ metadata.gz: f16ded1e988830364267df7d10ab98c2ecd19f22f52b72e0ddfd2a755be43ef7
4
+ data.tar.gz: 6f9207560467e19928cc219757878c2c017931d28e4e9f892e40e572c2ff7664
5
5
  SHA512:
6
- metadata.gz: ac6bcdba4e9e847ac4090e044640f0b9c047f682c4959fe1b3df835bee36eb5a130181aeb7400db5f36a215007c2eb6de4a12871dbe27e7c49f6a9c640643d28
7
- data.tar.gz: bbb8f2e92f5392c131d3124875d66ac2f0fc9ac34289718de789b5e0ce64d5a87892680fc44586572ebec45d95efeb7cae1238fbb7124c919462e889af616632
6
+ metadata.gz: 311277b318ee91cbc013a7fd62bd954a50b5b5e0e87946196e61cd63e397f197af9cfba65f1f29bd2c4be29e5f5b646972f0c7ace3d690cac0efd03a62f5479c
7
+ data.tar.gz: 6afa91a2abcd786f3e5f3f9a759ddeb8fd5fdf1e96e420ea6599a69b34cc1aa02a911a82a13ef455c77d2c1969e418838b0ead83e14e53550cf1de0d6ae15935
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- icodebreaker_gem (0.3.4)
4
+ icodebreaker_gem (0.3.8)
5
5
  rake (~> 13.0)
6
6
 
7
7
  GEM
@@ -66,6 +66,7 @@ GEM
66
66
  unicode-display_width (2.0.0)
67
67
 
68
68
  PLATFORMS
69
+ ruby
69
70
  x86_64-linux
70
71
 
71
72
  DEPENDENCIES
data/lib/game_core.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  module IcodebreakerGem
4
4
  class GameCore
5
5
  include Validation
6
+ attr_reader :secret
6
7
 
7
8
  def initialize(secret)
8
9
  validate_code secret
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IcodebreakerGem
4
- VERSION = '0.3.4'
4
+ VERSION = '0.3.8'
5
5
  end
@@ -2,4 +2,4 @@
2
2
 
3
3
  require_relative 'icodebreaker_gem/version'
4
4
  require_relative 'config'
5
- module IcodebreakerGem end
5
+ module IcodebreakerGem end
@@ -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 << game_data
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.safe_load(File.read(data_path)) || []
20
+ YAML.load(File.read(data_path)) || []
22
21
  end
23
22
 
24
23
  def sort_codebreakers
@@ -6,15 +6,21 @@ module IcodebreakerGem
6
6
  CODE = /^[1-6]{4}$/.freeze
7
7
 
8
8
  def validate_name(name)
9
- raise ArgumentError, 'Incorrect username' unless name.to_s.match?(USERNAME)
9
+ return unless name.to_s.match?(USERNAME)
10
+
11
+ true
10
12
  end
11
13
 
12
14
  def validate_code(code)
13
- raise ArgumentError, 'Incorrect code' unless code.to_s.match?(CODE)
15
+ return unless code.to_s.match?(CODE)
16
+
17
+ true
14
18
  end
15
19
 
16
20
  def validate_difficulty(difficulty)
17
- raise ArgumentError, 'No such difficulty' unless %i[easy medium hell].include? difficulty.to_s.to_sym
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
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-05 00:00:00.000000000 Z
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.26
161
+ rubygems_version: 3.1.2
162
162
  signing_key:
163
163
  specification_version: 4
164
164
  summary: The codebreaker game.