codebreaker_karolina 0.1.3 → 0.1.6

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: 84a47effeddafeda4411b08602e9a8de2cc07d16b3b43e480d79546bc951d470
4
- data.tar.gz: 2c9e78284baf9500f39059eb7512aa0e5ce28f9cbca28bb3567a688e47b8a121
3
+ metadata.gz: d0418f57963949cb02aa31edf503bfb3af5d480f7b78e01a233a756af9a69cbd
4
+ data.tar.gz: 660a9e181a3051a2644a06afb8cfaaf1387f776f59ea2aae1177bbcd97de7c87
5
5
  SHA512:
6
- metadata.gz: f483622d39b4a960722381a7ee15ea6288f5b2081f0802fb32854cb432405db7ca74ac6842bb7395f632f8e3ccf31238f3efc299c2360992f92288bc28ca6083
7
- data.tar.gz: e0d53cd64f77705bbf7dbba7c620cf046ae79c6d1e77db747469dea6a246610f7116e3f555996e5c234bf229e52bb3e67b295d32972ae5916bf51137dd44e738
6
+ metadata.gz: 1fc676f52ede5d75baa86406637fa859893c8d9e4790f54ef7fbe746f61701e365a9341865d9f774f627a47368147e2272b4b81f096067ae92d49cedcd608d76
7
+ data.tar.gz: d028d00f565f282ddd7d9ffa9d4a71749da04a8283fae0aa289cd2444449da6bdeb0749456efc8e036dd7b700a64c34d692a65483a5d08c178cdbf340e973d32
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- codebreaker_karolina (0.1.3)
4
+ codebreaker_karolina (0.1.6)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
Binary file
Binary file
@@ -1,3 +1,3 @@
1
1
  module CodebreakerKarolina
2
- VERSION = '0.1.3'.freeze
2
+ VERSION = '0.1.6'.freeze
3
3
  end
@@ -23,6 +23,8 @@ module CodebreakerKarolina
23
23
  private
24
24
 
25
25
  def load_file_stats
26
+ return [] unless File.file?(FILE_NAME)
27
+
26
28
  YAML.load_stream(File.open(FILE_NAME))
27
29
  end
28
30
  end
data/lib/modules/game.rb CHANGED
@@ -41,9 +41,7 @@ module CodebreakerKarolina
41
41
  private
42
42
 
43
43
  def valid_code?(code)
44
- return true if code =~ (/[1-6]{4}/)
45
-
46
- false
44
+ !!code[/\A[1-6]{4}\z/]
47
45
  end
48
46
 
49
47
  def generate_code
data/lib/modules/user.rb CHANGED
@@ -1,22 +1,18 @@
1
1
  class User
2
2
  attr_accessor :used_attempts, :used_hints
3
+ attr_reader :name
3
4
 
4
- def initialize
5
- @used_attempts = 0
6
- @used_hints = 0
7
- end
8
-
9
- def name(name)
5
+ def initialize(name)
10
6
  return unless valid?(name)
11
7
 
12
8
  @name = name
9
+ @used_attempts = 0
10
+ @used_hints = 0
13
11
  end
14
12
 
15
13
  private
16
14
 
17
15
  def valid?(name)
18
- return true if name.match(/[A-Za-z0-9_]{3,20}/)
19
-
20
- false
16
+ !!name[/\A[A-Za-z0-9]{3,20}\z/]
21
17
  end
22
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codebreaker_karolina
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - drkarolina
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-08 00:00:00.000000000 Z
11
+ date: 2022-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fasterer
@@ -127,6 +127,8 @@ files:
127
127
  - codebreaker_karolina-0.1.0.gem
128
128
  - codebreaker_karolina-0.1.1.gem
129
129
  - codebreaker_karolina-0.1.2.gem
130
+ - codebreaker_karolina-0.1.3.gem
131
+ - codebreaker_karolina-0.1.4.gem
130
132
  - lib/codebreaker_karolina.rb
131
133
  - lib/codebreaker_karolina/version.rb
132
134
  - lib/constants.rb