-
-
Save milothiesen/d1f0bdbb4ed9792ae5cd to your computer and use it in GitHub Desktop.
https://repl.it/BnUf/1 created by anonymous
This file contains 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
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 |
This file contains 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
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
this is from http://ruby.bastardsbook.com/chapters/collections/