Permalink
Browse files

Remove underscores and hyphens when finding suggestions

  • Loading branch information...
1 parent 97ac3d7 commit 5dc16ee02c72087738f249852df8068b3b4ee9de @presidentbeef committed Jan 1, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/rubygems/spec_fetcher.rb
@@ -188,14 +188,14 @@ def legacy_repos
# 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 5dc16ee

Please sign in to comment.