Class: RandomizerCreators::Password

Inherits:
RandomizerCreator show all
Defined in:
lib/creators/password.rb

Class Method Summary collapse

Methods inherited from RandomizerCreator

can_generate?

Class Method Details

.random_password(options = {}) ⇒ Object

Returns a random password using:

options => default 6



7
8
9
10
11
12
# File 'lib/creators/password.rb', line 7

def self.random_password(options = {})
  length = options[:length] || 6
  
  chars = ('a'..'z').to_a + ('A'..'Z').to_a + (0..9).collect{ |int| int.to_s }
  (0...length).collect { chars[rand(chars.length)] }.join
end