diff options
author | Peter Leitzen <pleitzen@gitlab.com> | 2019-07-26 10:44:13 +0000 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2019-07-26 10:44:13 +0000 |
commit | 8136fac26c8f470720ff90d152b93abf50f5084d (patch) | |
tree | 3f50aab69d5c5841d9b5aa1c9a64804eea29d877 /lib/gitlab/ci/status | |
parent | 0d2b5bff8c524376f42316f1a4cc8cfbeabc2d8d (diff) | |
download | gitlab-ce-8136fac26c8f470720ff90d152b93abf50f5084d.tar.gz |
Prefer `flat_map` over `map` + `flatten`
Convert several occurrences of `map` + `flatten` to
`flat_map` where applicable.
Diffstat (limited to 'lib/gitlab/ci/status')
-rw-r--r-- | lib/gitlab/ci/status/factory.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/gitlab/ci/status/factory.rb b/lib/gitlab/ci/status/factory.rb index 3446644eff8..2a0bf060c9b 100644 --- a/lib/gitlab/ci/status/factory.rb +++ b/lib/gitlab/ci/status/factory.rb @@ -34,11 +34,9 @@ module Gitlab def extended_statuses return @extended_statuses if defined?(@extended_statuses) - groups = self.class.extended_statuses.map do |group| + @extended_statuses = self.class.extended_statuses.flat_map do |group| Array(group).find { |status| status.matches?(@subject, @user) } - end - - @extended_statuses = groups.flatten.compact + end.compact end def self.extended_statuses |