readable_password_generator 0.0.4 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db4418d1296eae022c92822a1defde63cf838941a3b2c32604e0504b0aef00aa
4
- data.tar.gz: 39aab9b7a2e3f2bfd13fe887de01386e17cc8e8e87f659de99b10222cedcd24b
3
+ metadata.gz: 4d1330057ee6bf91719c4400d19e6212522ad4088dbed42498c58a6881acf24e
4
+ data.tar.gz: c870baed99f53d0f823d375589b046a4d52c49ff57abb46755c3e259a78f5ab0
5
5
  SHA512:
6
- metadata.gz: 3ec54ee71b155699db8aef82ceaaaa59cc4f576d76f1333725ad07af50bc04f3a365d74168df32226b7aece5a00721502fb4c17aabf8cb997b1292267f577b5a
7
- data.tar.gz: a260c9167ecce3f566ca9566357d1a37941b9b88a0859d98bdbdf365d909e1b04fd3a70933e6ee8b8e93fc34f4ca29bfcafed896b1a4e47251e9032d419819f7
6
+ metadata.gz: a7ceb479590cd20e451d894101a311cb9eec52c3ce7bbe865476e6c8f70332ae7ee407b7614454ae332a3346a93c4faa7e028d0e61fbb98cc2d114a1ce98c27b
7
+ data.tar.gz: fa80940174a0638966c1105a0e58b44f39116f131e1c2c91a5c33c8496a50f86128da972ba3f66d02cfcbed9f8ea9935001f8c89d9147f9e0cbd4e3de39938e6
@@ -7,7 +7,7 @@ class Password
7
7
 
8
8
  def generate(length = DEFAULT_LENGTH)
9
9
  length = validate_length(length)
10
- vowel_position = rand(0...1)
10
+ vowel_position = [0,1].sample
11
11
  size, password = length, ""
12
12
  char_set = 0
13
13
  size.times do |char|
@@ -27,6 +27,7 @@ class Password
27
27
  length = length.sample
28
28
  elsif length.is_a?(Range)
29
29
  length = rand(length)
30
+ end
30
31
  if length.is_a?(Integer)
31
32
  if (length < 1) || (length > 100)
32
33
  raise Exception.new("Length cannot be #{length}, length must be in range of 1-100!")
@@ -41,11 +42,7 @@ class Password
41
42
  if char_set == vowel_position
42
43
  VOWELS.sample
43
44
  else
44
- if rand(1...4) == 4
45
- CONSONANTS.sample
46
- else
47
- DOUBLE_CONSONANTS.sample
48
- end
45
+ rand(1...4) == 4 ? CONSONANTS.sample : DOUBLE_CONSONANTS.sample
49
46
  end
50
47
  end
51
48
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: readable_password_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vitaly Platonov