Fix Style/ReduceToHash cop (#38088)

This commit is contained in:
Matt Jankowski authored and GitHub committed 2026-03-09 10:01:12 +00:00
1 parent 3a796544e3
commit fcc3fac8a8
6 files changed
+21 -21

No files matched your search

+1 -1
View File
@@ -71,7 +71,7 @@ class EmojiFormatter
private
def emoji_map
@emoji_map ||= custom_emojis.each_with_object({}) { |e, h| h[e.shortcode] = [full_asset_url(e.image.url), full_asset_url(e.image.url(:static))] }
@emoji_map ||= custom_emojis.to_h { |e| [e.shortcode, [full_asset_url(e.image.url), full_asset_url(e.image.url(:static))]] }
end
def tag_for_emoji(shortcode, emoji)
+1 -1
View File
@@ -51,7 +51,7 @@ class Importer::BaseImporter
raise ActiveRecord::UnknownPrimaryKey, index.adapter.target if primary_key.nil?
ids = documents.pluck('_id')
existence_map = index.adapter.target.where(primary_key => ids).pluck(primary_key).each_with_object({}) { |id, map| map[id.to_s] = true }
existence_map = index.adapter.target.where(primary_key => ids).pluck(primary_key).to_h { |id| [id.to_s, true] }
tmp = ids.reject { |id| existence_map[id] }
next if tmp.empty?