Created
May 20, 2017 17:39
-
-
Save ryenski/1cb61d1bd1e596f7a4182b169a059f35 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PronounceablePassword | |
WORDS = (IO.readlines(File.join File.dirname(__FILE__), 'words.txt')).each { |w| w.chop! } | |
class << self | |
def random_pronouncable_password(options={}) | |
options={ | |
:rand_seed => 999 | |
}.update(options) | |
words = WORDS.dup | |
[words.delete_at(rand(words.length)), rand(options[:rand_seed]), words[rand(words.length)]].join("-") | |
end | |
alias_method :generate_password!, :random_pronouncable_password | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment