Permalink
Browse files

Remove underscores and dashes when finding suggestions

  • Loading branch information...
1 parent df76864 commit 4c4c544b13ae09e5ede43426e64a90807c4fee46 @presidentbeef committed Dec 12, 2010
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/rubygems/spec_fetcher.rb
@@ -187,14 +187,14 @@ def legacy_repos
# Suggests gems based on the supplied +gem_name+. Returns an array of
# alternative gem names.
def suggest_gems_from_name gem_name
- gem_name = gem_name.downcase
+ gem_name = gem_name.downcase.tr("_-", "")
max = gem_name.size / 2
specs = list.values.flatten(1) # flatten(1) is 1.8.7 and up
matches = specs.map { |name, version, platform|
next unless Gem::Platform.match platform
- distance = levenshtein_distance gem_name, name.downcase
+ distance = levenshtein_distance gem_name, name.downcase.tr("_-", "")
next if distance >= max

0 comments on commit 4c4c544

Please sign in to comment.