Class: RandomizerCreators::Password
- Inherits:
-
RandomizerCreator
- Object
- RandomizerCreator
- RandomizerCreators::Password
- Defined in:
- lib/creators/password.rb
Class Method Summary collapse
-
.random_password(options = {}) ⇒ Object
Returns a random password using:.
Methods inherited from RandomizerCreator
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( = {}) length = [: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 |