Class: Amqpop::AuthFile
- Inherits:
-
Object
- Object
- Amqpop::AuthFile
- Defined in:
- lib/amqpop/auth_file.rb
Instance Method Summary collapse
-
#initialize ⇒ AuthFile
constructor
A new instance of AuthFile.
- #lookup(match_host, match_user = "") ⇒ Object
Constructor Details
#initialize ⇒ AuthFile
Returns a new instance of AuthFile.
6 7 8 9 |
# File 'lib/amqpop/auth_file.rb', line 6 def initialize @hosts = {} load_available_files end |
Instance Method Details
#lookup(match_host, match_user = "") ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/amqpop/auth_file.rb', line 11 def lookup(match_host, match_user = "") host = @hosts[match_host] return nil if host.nil? return nil if host.keys.empty? match_user = host.keys.first if match_user.to_s == "" pass = host[match_user] return nil if pass.to_s == "" {:host => match_host, :username => match_user, :password => pass} end |