Optimize map { ... }.compact calls (#15513)

* Optimize map { ... }.compact

using Enumerable#filter_map, supported since Ruby 2.7

* Add poyfill for Enumerable#filter_map
This commit is contained in:
luigi
2021-01-09 18:32:01 -05:00
committed by GitHub
parent 9395143126
commit 087ed84367
22 changed files with 52 additions and 26 deletions

View File

@ -37,7 +37,7 @@ class ActivityPub::ProcessCollectionService < BaseService
end
def process_items(items)
items.reverse_each.map { |item| process_item(item) }.compact
items.reverse_each.filter_map { |item| process_item(item) }
end
def supported_context?