Created
October 30, 2011 03:54
-
-
Save jdsumsion/1325447 to your computer and use it in GitHub Desktop.
Backward 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
def backwards_name(name) | |
name.split(/ +/) | |
.map { |piece| piece = piece.reverse; "#{piece[0].upcase}#{piece[1..-1].downcase}" } | |
.join(" ") | |
end | |
>> backwards_name "John Sumsion" | |
=> "Nhoj Noismus" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment