password_dynamo 0.0.00012 → 0.0.00013
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dynamo.rb +11 -2
- metadata +1 -1
data/lib/dynamo.rb
CHANGED
@@ -4,9 +4,18 @@ class Dynamo
|
|
4
4
|
def initialize
|
5
5
|
end
|
6
6
|
|
7
|
-
def generate_password(words_in_password = 4)
|
7
|
+
def generate_password(style = :simple, words_in_password = 4)
|
8
8
|
word_array = []
|
9
|
+
|
9
10
|
words_in_password.times{ word_array << WORDS.sample }
|
10
|
-
|
11
|
+
|
12
|
+
case style
|
13
|
+
when :simple
|
14
|
+
word_array.join(' ')
|
15
|
+
when :complex
|
16
|
+
digits = %w(0 1 2 3 4 5 6 7 8 9)
|
17
|
+
word_array.first.capitalize!
|
18
|
+
word_array.shuffle.join('-').sub!(/-/, digits.sample)
|
19
|
+
end
|
11
20
|
end
|
12
21
|
end
|