Created
August 19, 2012 07:12
-
-
Save brookr/3393076 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def(username) | |
| possibilities = profiles.keys.select { |u| username.downcase == u.downcase[0, username.length] } | |
| if possibilities.include? username | |
| [username] | |
| else | |
| possibilities | |
| end | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the event that
usernameis a case-insensitive match,[username]will be returned, which doesn't preserve the case of the value that is already stored.