Skip to content

Instantly share code, notes, and snippets.

@brookr
Created August 19, 2012 07:12
Show Gist options
  • Select an option

  • Save brookr/3393076 to your computer and use it in GitHub Desktop.

Select an option

Save brookr/3393076 to your computer and use it in GitHub Desktop.
def(username)
possibilities = profiles.keys.select { |u| username.downcase == u.downcase[0, username.length] }
if possibilities.include? username
[username]
else
possibilities
end
end
@brookr

brookr commented Aug 19, 2012

Copy link
Copy Markdown
Author

In the event that username is a case-insensitive match, [username] will be returned, which doesn't preserve the case of the value that is already stored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment