Add an apply Rails/CompactBlank rubocop rule

In rubocop-rails 2.26.0, the Rails/CompactBlank rule was modified to handle
cases where select(&:present?) is used. After identifying three occurrences
in our code, we've decided to apply this rule as it encourages the use of the
more efficient and clearer method, compact_blank.

By using compact_blank, we improve code clarity and performance, as this method performs the same operation but in a more optimized way.
This commit is contained in:
taitus
2024-10-08 17:12:19 +02:00
parent c50452aec6
commit 29df39b2fa
5 changed files with 7 additions and 4 deletions

View File

@@ -13,7 +13,7 @@ class Shared::LinkListComponent < ApplicationComponent
private
def present_links
links.select(&:present?)
links.compact_blank
end
def list_items