Sha256: bcac932f545d8cbed3a0e515cea798d382b9c84d1825cf15c08ff14b6e6799f2

Contents?: true

Size: 475 Bytes

Versions: 30

Compression:

Stored size: 475 Bytes

Contents

require 'csv'

class Gratan::Identifier::CSV
  include Gratan::Logger::Helper

  def initialize(path, options = {})
    @options = options
    @passwords = {}

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

  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
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
gratan-0.3.2 lib/gratan/identifier/csv.rb
gratan-0.3.1 lib/gratan/identifier/csv.rb
gratan-0.3.1.beta4 lib/gratan/identifier/csv.rb
gratan-0.3.1.beta3 lib/gratan/identifier/csv.rb
gratan-0.3.1.beta2 lib/gratan/identifier/csv.rb
gratan-0.3.1.beta lib/gratan/identifier/csv.rb
gratan-0.3.0 lib/gratan/identifier/csv.rb
gratan-0.3.0.beta lib/gratan/identifier/csv.rb
gratan-0.2.9 lib/gratan/identifier/csv.rb
gratan-0.2.9.beta3 lib/gratan/identifier/csv.rb
gratan-0.2.9.beta2 lib/gratan/identifier/csv.rb
gratan-0.2.9.beta lib/gratan/identifier/csv.rb
gratan-0.2.8 lib/gratan/identifier/csv.rb
gratan-0.2.8.beta3 lib/gratan/identifier/csv.rb
gratan-0.2.8.beta2 lib/gratan/identifier/csv.rb
gratan-0.2.8.beta lib/gratan/identifier/csv.rb
gratan-0.2.7 lib/gratan/identifier/csv.rb
gratan-0.2.6 lib/gratan/identifier/csv.rb
gratan-0.2.5 lib/gratan/identifier/csv.rb
gratan-0.2.4 lib/gratan/identifier/csv.rb