Class: Gratan::Identifier::Auto

Inherits:
Object
  • Object
show all
Defined in:
lib/gratan/identifier/auto.rb

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Auto.



2
3
4
5
6
# File 'lib/gratan/identifier/auto.rb', line 2

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

Instance Method Details

#identify(user, host) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/gratan/identifier/auto.rb', line 8

def identify(user, host)
  if @cache[user]
    password = @cache[user]
  else
    password = mkpasswd
    @cache[user] = password
  end

  puts_password(user, host, password)
  password
end