Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completed #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Completed #27

wants to merge 1 commit into from

Conversation

rpriya123
Copy link


string_store = string.gsub(/[_-]/,' ').split(/\s/)
if string_store.include? word
return :yes.to_sym
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're calling #to_sym on something that is already a symbol!

@sjreich
Copy link
Contributor

sjreich commented Jan 14, 2016

I like the overall approach - split the string into an array of words, then check whether that array contains the word in question.

return :yes.to_sym
else
return :no.to_sym
end
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since that if statement is the last thing to be evaluated in the method, the return statements aren't needed. In general, Ruby style is to skip the use of return except for early returns (e.g. guard clauses).

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.

3 participants