class Gratan::Identifier::CSV

Public Class Methods

new(path, options = {}) click to toggle source
# File lib/gratan/identifier/csv.rb, line 6
def initialize(path, options = {})
  @options = options
  @passwords = {}

  CSV.foreach(path) do |row|
    @passwords[row[0]] = row[1]
  end
end

Public Instance Methods

identify(user, host) click to toggle source
# File lib/gratan/identifier/csv.rb, line 15
def identify(user, host)
  user_host = "#{user}@#{host}"
  password = @passwords[user_host]

  unless password
    log(:warn, "password for `#{user_host}` can not be found", :color => :yellow)
  end

  password
end