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:
@ -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?
|
||||
|
Reference in New Issue
Block a user