diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2019-02-13 20:26:00 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2019-02-14 10:52:17 +0300 |
commit | 50491d324135f14e817d7de9d825b9ce4dacc5ef (patch) | |
tree | c0a187360e24d40a95f48b1e1a150840384dd2b3 /lib/gitlab/graphql | |
parent | 30918929ad079a591b85303d6662ec0a43c5df04 (diff) |
Instead of returning all or nothing, return whichever passed
And add tests
Diffstat (limited to 'lib/gitlab/graphql')
-rw-r--r-- | lib/gitlab/graphql/authorize/instrumentation.rb | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/gitlab/graphql/authorize/instrumentation.rb b/lib/gitlab/graphql/authorize/instrumentation.rb index d6d3ff300f6..2a3d790d67b 100644 --- a/lib/gitlab/graphql/authorize/instrumentation.rb +++ b/lib/gitlab/graphql/authorize/instrumentation.rb @@ -45,15 +45,12 @@ module Gitlab end end - checked = - case value - when Array - value.all?(&check) - else - check.call(value) - end - - value if checked + case value + when Array + value.select(&check) + else + value if check.call(value) + end end end end |