Last active
June 1, 2018 19:30
-
-
Save flanger001/908c09c6d050d726c2029d57ef2b7455 to your computer and use it in GitHub Desktop.
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
class String | |
def rotate_vowels(num = 1) | |
vowels = "aeiou" | |
uc_vowels = vowels.upcase | |
tr(uc_vowels, uc_vowels.chars.rotate(num).join).tr(vowels, vowels.chars.rotate(num).join) | |
end | |
end | |
str = "Hey, I'm gonna need you to come in on Saturday." | |
str.rotate_vowels | |
# => "Hiy, O'm gunne niid yua tu cumi on un Setardey." | |
str.rotate_vowels(2) | |
# => "Hoy, U'm ganni nood yae ta camo un an Siterdiy." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment