From 16e43f2ccbca8fb10bb39c5145904a15e6219e17 Mon Sep 17 00:00:00 2001 From: "G. Wade Johnson" Date: Thu, 1 Oct 2015 16:17:39 -0500 Subject: [PATCH 1/2] Passes the spec, but I can still see some potential issues --- parser.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/parser.rb b/parser.rb index adaad3e..2bbdbce 100644 --- a/parser.rb +++ b/parser.rb @@ -1,3 +1,4 @@ def word_in_string?(word, string) # implement with your code here + string.match( /(?:\b|_)#{word}(?:\b|_)/ ).nil? ? :no : :yes end From 1d0e51d87d772a850be05a97a3d234c5fe4e3b0d Mon Sep 17 00:00:00 2001 From: "G. Wade Johnson" Date: Tue, 6 Oct 2015 14:33:12 -0400 Subject: [PATCH 2/2] Simplify logic --- parser.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parser.rb b/parser.rb index 2bbdbce..1fa7bd5 100644 --- a/parser.rb +++ b/parser.rb @@ -1,4 +1,4 @@ def word_in_string?(word, string) # implement with your code here - string.match( /(?:\b|_)#{word}(?:\b|_)/ ).nil? ? :no : :yes + string.match( /(?:\b|_)#{word}(?:\b|_)/ ) ? :yes : :no end