Skip to content

Instantly share code, notes, and snippets.

Created February 16, 2016 21:25
Show Gist options
  • Save anonymous/118ef671c9b8addf53fc to your computer and use it in GitHub Desktop.
Save anonymous/118ef671c9b8addf53fc to your computer and use it in GitHub Desktop.
https://repl.it/BnUf/1 created by anonymous
names = ["Jill Bauerle", "Iris Lee", "Gregory Raml", "Maile Thiesen", "Jane Levenson", "Rebecca Morgan"]
sorted_names = names.sort_by{ |name| name.split(" ").reverse.join.upcase }
puts sorted_names
ruby 2.2.0p0 (2014-12-25 revision 49005)
>>> Jill Bauerle
Iris Lee
Jane Levenson
Rebecca Morgan
Gregory Raml
Maile Thiesen
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment