Class: PassGen::Password

Inherits:
String
  • Object
show all
Defined in:
lib/passgen/password.rb

Constant Summary collapse

LETTERS =
('a'..'z').to_a
NUMBERS =
('0'..'9').to_a

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Password

Returns a new instance of Password.



9
10
11
12
13
14
# File 'lib/passgen/password.rb', line 9

def initialize(options={})
  @count = options[:length] || 10
  super(random_characters)
rescue SystemStackError => e
  raise e, 'try specifying a shorter password length'
end

Instance Method Details

#hexedObject



16
17
18
# File 'lib/passgen/password.rb', line 16

def hexed
  Digest::SHA1.hexdigest(self)
end