From 863f508b9e1b87b3e5ca62db31e86a1791402b2d Mon Sep 17 00:00:00 2001 From: MariaWissler <31623564+MariaWissler@users.noreply.github.com> Date: Fri, 8 Feb 2019 10:34:25 -0800 Subject: [PATCH 1/3] Create generator.rb --- generator.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 generator.rb diff --git a/generator.rb b/generator.rb new file mode 100644 index 0000000..6c0d8a9 --- /dev/null +++ b/generator.rb @@ -0,0 +1,10 @@ +# method is a vowel ? +# user input +# split the word and compare to see if a vowel, from 0 to lenght, push to store +# split second word compare to see if is a vowel starting at -1 and store +# put this two values together +def includes_vowel (word) + word.each_char +end + +puts From aacef89daf02b361fe0f44d7e0e2e4dc633cd916 Mon Sep 17 00:00:00 2001 From: MariaWissler <31623564+MariaWissler@users.noreply.github.com> Date: Sat, 9 Feb 2019 22:45:25 -0800 Subject: [PATCH 2/3] Update generator.rb --- generator.rb | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/generator.rb b/generator.rb index 6c0d8a9..8be4f0d 100644 --- a/generator.rb +++ b/generator.rb @@ -1,10 +1,29 @@ -# method is a vowel ? -# user input -# split the word and compare to see if a vowel, from 0 to lenght, push to store -# split second word compare to see if is a vowel starting at -1 and store -# put this two values together -def includes_vowel (word) - word.each_char +def get_the_vowel(word) + word.length > 1 && word =~ /[aeiou]/ end -puts +puts "Please enter your first word" +first_word = gets.chomp.downcase + until get_the_vowel(first_word) + puts "Please enter a word with 2 or more characters and a vowel" + first_word = gets.chomp.downcase + end + +words = [] +a = first_word.rindex(/[aeiou].*/) +word_a = first_word[0...a] +words << word_a + +puts "Please enter your second word" +second_word = gets.chomp.downcase + until get_the_vowel(second_word) + puts "Please enter a word with 2 or more characters and a vowel" + second_word = gets.chomp.downcase + end + +b = second_word.split(/([aeiou].*)/) +word_b = b[1] +words << word_b + +puts "Word #{word_a} + #{word_b} is #{words.join("")}" +end From 41530c3a8bd8789f8b42608cfe64521932878949 Mon Sep 17 00:00:00 2001 From: MariaWissler <31623564+MariaWissler@users.noreply.github.com> Date: Sat, 9 Feb 2019 23:02:27 -0800 Subject: [PATCH 3/3] Update generator.rb --- generator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generator.rb b/generator.rb index 8be4f0d..4e3a525 100644 --- a/generator.rb +++ b/generator.rb @@ -26,4 +26,4 @@ def get_the_vowel(word) words << word_b puts "Word #{word_a} + #{word_b} is #{words.join("")}" -end +