Skip to content

Conversation

@Add9Sus4
Copy link

@Add9Sus4 Add9Sus4 commented Jan 7, 2016

No description provided.

@sjreich
Copy link
Contributor

sjreich commented Jan 8, 2016

I'd say give this one another shot. Use two spaces to indent. And see if you can't substantially reduce the amount of code, and avoid the need for the return keyword.

@sjreich
Copy link
Contributor

sjreich commented Jan 9, 2016

Looks a lot better. 👍

If you call a #split on the string first, you'll end up with an array of words, and then your regex can be a lot simpler.

Also, === is probably better than =~ here. Whereas the latter returns the index of the first match, which can be cast into a boolean, the former returns a boolean directly. Just remember that it's a regexp method, so the regexp has to go on the left side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants