Class: Miam::PasswordManager

Inherits:
Object
  • Object
show all
Includes:
Logger::Helper
Defined in:
lib/miam/password_manager.rb

Instance Method Summary collapse

Methods included from Logger::Helper

#log

Constructor Details

#initialize(output, options = {}) ⇒ PasswordManager

Returns a new instance of PasswordManager.



4
5
6
7
# File 'lib/miam/password_manager.rb', line 4

def initialize(output, options = {})
  @output = output
  @options = options
end

Instance Method Details

#identify(user, type) ⇒ Object



9
10
11
12
13
# File 'lib/miam/password_manager.rb', line 9

def identify(user, type)
  password = mkpasswd
  puts_password(user, type, password)
  password
end

#puts_password(user, type, password) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/miam/password_manager.rb', line 15

def puts_password(user, type, password)
  log(:info, "User `#{user}` > `#{type}`: put password to `#{@output}`")

  open_output do |f|
    f.puts("#{user},#{type},#{password}")
  end
end