Autofix Rubocop Rails/Pluck (#23730)
This commit is contained in:
parent
597767a9f7
commit
21bf326356
7 changed files with 14 additions and 25 deletions
|
@ -45,7 +45,7 @@ class Importer::BaseImporter
|
|||
# Remove documents from the index that no longer exist in the database
|
||||
def clean_up!
|
||||
index.scroll_batches do |documents|
|
||||
ids = documents.map { |doc| doc['_id'] }
|
||||
ids = documents.pluck('_id')
|
||||
existence_map = index.adapter.target.where(id: ids).pluck(:id).each_with_object({}) { |id, map| map[id.to_s] = true }
|
||||
tmp = ids.reject { |id| existence_map[id] }
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ class LinkDetailsExtractor
|
|||
end
|
||||
|
||||
def language
|
||||
valid_locale_or_nil(structured_data&.language || opengraph_tag('og:locale') || document.xpath('//html').map { |element| element['lang'] }.first)
|
||||
valid_locale_or_nil(structured_data&.language || opengraph_tag('og:locale') || document.xpath('//html').pick('lang'))
|
||||
end
|
||||
|
||||
def icon
|
||||
|
@ -220,15 +220,15 @@ class LinkDetailsExtractor
|
|||
end
|
||||
|
||||
def link_tag(name)
|
||||
document.xpath("//link[@rel=\"#{name}\"]").map { |link| link['href'] }.first
|
||||
document.xpath("//link[@rel=\"#{name}\"]").pick('href')
|
||||
end
|
||||
|
||||
def opengraph_tag(name)
|
||||
document.xpath("//meta[@property=\"#{name}\" or @name=\"#{name}\"]").map { |meta| meta['content'] }.first
|
||||
document.xpath("//meta[@property=\"#{name}\" or @name=\"#{name}\"]").pick('content')
|
||||
end
|
||||
|
||||
def meta_tag(name)
|
||||
document.xpath("//meta[@name=\"#{name}\"]").map { |meta| meta['content'] }.first
|
||||
document.xpath("//meta[@name=\"#{name}\"]").pick('content')
|
||||
end
|
||||
|
||||
def structured_data
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue