Created
April 12, 2016 23:53
-
-
Save jkarnowski/d87d08e5e3c6c2e7295b2474bed76527 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 convert_to_pig_latin(word) | |
@word_array = word.downcase.split("") | |
@vowels = ['a', 'e', 'i', 'o', 'u'] | |
if @vowels.include?(@word_array[0]) | |
word = @word_array.join('') | |
else | |
move_letters | |
add_ay | |
end | |
end | |
def move_letters | |
first_letter = @word_array.shift | |
@first_letter_at_end = @word_array.push(first_letter).join('') | |
end | |
def add_ay | |
@first_letter_at_end + "ay" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment