Simplify regex.

This commit is contained in:
Douwe Maan 2015-04-14 15:58:16 +02:00
parent 1221bec56c
commit 076494646d
1 changed files with 3 additions and 3 deletions

View File

@ -27,10 +27,10 @@ module Gitlab
return nil unless cmd_status.zero?
# 16 hex bytes separated by ':', optionally starting with "MD5:"
fingerprint_match = cmd_output.match(/(MD5:)?(?<fingerprint>(?:\h{2}:){15}\h{2})/)
return nil unless fingerprint_match
fingerprint_matches = cmd_output.match(/(MD5:)?(?<fingerprint>(\h{2}:){15}\h{2})/)
return nil unless fingerprint_matches
fingerprint_match[:fingerprint]
fingerprint_matches[:fingerprint]
end
private