Created
August 30, 2012 18:13
-
-
Save domkm/3536189 to your computer and use it in GitHub Desktop.
Dev Bootcamp Birthday Torture
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 happy_birthday(name, torture_level = 100) | |
hb = "Happy Birthday to You." | |
song = "#{hb} #{hb} Happy Birthday Dear #{name}. #{hb}" | |
song.chars.reduce do |memo, char| | |
%w[a e i o u y].include?(char) ? memo + char * torture_level : memo + char | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment