Created
September 7, 2014 00:31
-
-
Save anonymous/d14d213fe14bdb606bfa 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
def vowels(any_string) | |
vowel = ["a","e","i","o","u"] | |
if vowel.include? any_string[0] | |
true | |
else | |
false | |
end | |
end | |
def first_letter(words) | |
words[0] | |
end | |
def first_two(words) | |
words[0..1] | |
end | |
def translate(any_string) | |
if vowels(any_string) == true && any_string.include?(" ") | |
any_string.map { |word| word + "ay " } | |
elsif vowels(any_string) == true | |
any_string + "ay" | |
elsif vowels(any_string) == false | |
any_string[1..-1] + first_letter + "ay" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment