Skip to content

Commit

Permalink
unique and sort usernames in the output
Browse files Browse the repository at this point in the history
  • Loading branch information
digininja committed Apr 22, 2014
1 parent 3a8b6d1 commit b412bc9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions checkers_available/username.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ def process_word (word, extras)
username = extras['username']

if word == username
@exact_matches << word
if not @exact_matches.include? word
@exact_matches << word
end
else
dist = Levenshtein.distance(word, username)
puts "Lev distance #{dist}#" if @verbose
Expand All @@ -64,7 +66,7 @@ def get_results()

ret_str << "Exact Matches\n"
if @exact_matches.count > 0
@exact_matches.each do |match|
@exact_matches.sort.each do |match|
ret_str << "#{match}\n"
end
else
Expand Down

0 comments on commit b412bc9

Please sign in to comment.