Sha256: 17860c80a99f111f733d47da9645dd6de40d7fe992025505863c8626ce28fccd
Contents?: true
Size: 721 Bytes
Versions: 1
Compression:
Stored size: 721 Bytes
Contents
class Gratan::Identifier::Auto def initialize(output, options = {}) @options = options unless @options[:dry_run] if output == '-' @output = $stdout else @output = open(output, 'w') end end @cache = {} end def identify(user, host) if @cache[user] password = @cache[user] else password = mkpasswd @cache[user] = password end puts_password(user, host, password) password end private def mkpasswd(len = 8) [*1..9, *'A'..'Z', *'a'..'z'].shuffle.slice(0, len).join end def puts_password(user, host, password) if @output @output.puts("#{user}@#{host},#{password}") @output.flush end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gratan-0.2.1 | lib/gratan/identifier/auto.rb |