Fix Style/ReduceToHash cop (#38088)
This commit is contained in:
1 parent
3a796544e3
commit
fcc3fac8a8
6 files changed
+21
-21
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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?
|
||||
|
||||
Reference in new issue
Block a user