From 3aac0fef7eaeff3cc50b873c921d80dca0ba6810 Mon Sep 17 00:00:00 2001 From: apainintheneck Date: Wed, 14 Dec 2022 00:26:01 -0800 Subject: [PATCH] Simplify cask search The cask_tokens and cask_names arrays here were almost identical so we'll just use cask_tokens for both. --- Library/Homebrew/cask/cask.rb | 10 ---------- Library/Homebrew/extend/os/mac/search.rb | 3 +-- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/Library/Homebrew/cask/cask.rb b/Library/Homebrew/cask/cask.rb index 915beb71b9..9775e80bd8 100644 --- a/Library/Homebrew/cask/cask.rb +++ b/Library/Homebrew/cask/cask.rb @@ -38,16 +38,6 @@ module Cask end.compact end - def self.full_names - Tap.flat_map do |tap| - next tap.cask_tokens.blank? - next tap.cask_tokens if tap.user == "Homebrew" - - name = tap.name - tap.cask_tokens.map { |tok| "#{name}/#{tok}" } - end.flatten - end - def tap return super if block_given? # Object#tap diff --git a/Library/Homebrew/extend/os/mac/search.rb b/Library/Homebrew/extend/os/mac/search.rb index 6a094d30bd..5901ac74ba 100644 --- a/Library/Homebrew/extend/os/mac/search.rb +++ b/Library/Homebrew/extend/os/mac/search.rb @@ -37,8 +37,7 @@ module Homebrew results = cask_tokens.extend(Searchable) .search(string_or_regex) - cask_names = Cask::Cask.full_names - results += DidYouMean::SpellChecker.new(dictionary: cask_names) + results += DidYouMean::SpellChecker.new(dictionary: cask_tokens) .correct(string_or_regex) results.sort.map do |name|