Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRubén Dávila <ruben@gitlab.com>2017-09-30 01:55:36 +0300
committerRubén Dávila <ruben@gitlab.com>2017-10-05 16:25:27 +0300
commitc50725fecfb776d56c95ef070940ca6c85786ecf (patch)
tree86695f75d9f3ef3595ed1970ccb960898098cba7 /lib/gitlab/gpg.rb
parentc2c35ae7971d19396078bdec6474fdd58f66000c (diff)
Address feedback from last code review
Diffstat (limited to 'lib/gitlab/gpg.rb')
-rw-r--r--lib/gitlab/gpg.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/gitlab/gpg.rb b/lib/gitlab/gpg.rb
index 343bf54a6ae..413872d7e08 100644
--- a/lib/gitlab/gpg.rb
+++ b/lib/gitlab/gpg.rb
@@ -36,15 +36,14 @@ module Gitlab
def subkeys_from_key(key)
using_tmp_keychain do
- fingerprints = CurrentKeyChain.fingerprints_from_key(key)
- raw_keys = GPGME::Key.find(:public, fingerprints)
- grouped_subkeys = Hash.new { |h, k| h[k] = [] }
+ fingerprints = CurrentKeyChain.fingerprints_from_key(key)
+ raw_keys = GPGME::Key.find(:public, fingerprints)
- raw_keys.each_with_object(grouped_subkeys).each do |raw_key, subkeys|
+ raw_keys.each_with_object({}) do |raw_key, grouped_subkeys|
primary_subkey_id = raw_key.primary_subkey.keyid
- raw_key.subkeys[1..-1].each do |subkey|
- subkeys[primary_subkey_id] << { keyid: subkey.keyid, fingerprint: subkey.fingerprint }
+ grouped_subkeys[primary_subkey_id] = raw_key.subkeys[1..-1].map do |s|
+ { keyid: s.keyid, fingerprint: s.fingerprint }
end
end
end