Class: PasswordChanger::PasswordGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/password_changer/password_generator.rb

Instance Method Summary collapse

Instance Method Details

#generate(old_password: '', length: 8) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/password_changer/password_generator.rb', line 4

def generate(old_password: '', length: 8)
  loop do
    new_password = generate_string(length)

    return new_password if is_totally_different?(old_password, new_password) && includes_number?(new_password) && has_no_doubled_letters?(new_password)
  end
end