Class: Gratan::Identifier::CSV
- Inherits:
-
Object
- Object
- Gratan::Identifier::CSV
- Includes:
- Logger::Helper
- Defined in:
- lib/gratan/identifier/csv.rb
Instance Method Summary collapse
- #identify(user, host) ⇒ Object
-
#initialize(path, options = {}) ⇒ CSV
constructor
A new instance of CSV.
Methods included from Logger::Helper
Constructor Details
#initialize(path, options = {}) ⇒ CSV
Returns a new instance of CSV.
6 7 8 9 10 11 12 13 |
# File 'lib/gratan/identifier/csv.rb', line 6 def initialize(path, = {}) = @passwords = {} CSV.foreach(path) do |row| @passwords[row[0]] = row[1] end end |
Instance Method Details
#identify(user, host) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# 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 |