From 6e0db9e5270cf46028d75886ed7ace719febba7d Mon Sep 17 00:00:00 2001 From: Kaleb Davis Date: Fri, 5 Jun 2015 11:09:09 -0400 Subject: [PATCH 1/2] parser complete, tests pass --- parser.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/parser.rb b/parser.rb index adaad3e..d032ce7 100644 --- a/parser.rb +++ b/parser.rb @@ -1,3 +1,7 @@ def word_in_string?(word, string) - # implement with your code here + if string.split(/[^a-zA-Z]/).include? word + :yes + else + :no + end end From 08909ebc0c49ac38a078989d60e9ed9ba0a63293 Mon Sep 17 00:00:00 2001 From: Kaleb Davis Date: Fri, 5 Jun 2015 11:12:01 -0400 Subject: [PATCH 2/2] update method to use conditional operator --- parser.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/parser.rb b/parser.rb index d032ce7..d6d38b7 100644 --- a/parser.rb +++ b/parser.rb @@ -1,7 +1,3 @@ def word_in_string?(word, string) - if string.split(/[^a-zA-Z]/).include? word - :yes - else - :no - end + string.split(/[^a-zA-Z]/).include?(word) ? :yes : :no end