Make code clearer

This commit is contained in:
Douwe Maan 2015-09-16 09:14:04 +02:00
parent bed263f0fe
commit 84d57bc703
1 changed files with 9 additions and 11 deletions

View File

@ -6,17 +6,15 @@ module Gitlab
private private
def get_info(key) def get_info(key)
raw_key = ldap_config.attributes[key] attributes = ldap_config.attributes[key]
return super unless raw_key return super unless attributes
value = attributes = Array(attributes)
case raw_key
when String value = nil
get_raw(raw_key) attributes.each do |attribute|
when Array value = get_raw(attribute)
raw_key.inject(nil) { |value, key| value || get_raw(key).presence } break if value.present?
else
nil
end end
return super unless value return super unless value