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 +4 -4
- data/lib/readable_password_generator.rb +3 -6
- 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: 4d1330057ee6bf91719c4400d19e6212522ad4088dbed42498c58a6881acf24e
|
4
|
+
data.tar.gz: c870baed99f53d0f823d375589b046a4d52c49ff57abb46755c3e259a78f5ab0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =
|
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
|
-
|
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
|