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

Changed return value of boolean method from nil to boolean value #379

Closed
wants to merge 2 commits into from
Closed

Changed return value of boolean method from nil to boolean value #379

wants to merge 2 commits into from

Conversation

Shigeyuki-fukuda
Copy link

@Shigeyuki-fukuda Shigeyuki-fukuda commented May 24, 2019

Summary

  • I made boolean method appropriate. 8ef8400
    ex: firefox?
  • I also fixed offenses of rubocop. 1cac594

Before

To give an example, when you accessed a website by Chrome.
Boolean methods will return nil except for case of Chrome.

$ browser = Browser.new(request.env['HTTP_USER_AGENT'])
$ browser.firefox?
=> nil

After

$ browser = Browser.new(request.env['HTTP_USER_AGENT'])
$ browser.firefox?
=> false

@fnando
Copy link
Owner

fnando commented Jul 15, 2019

This subject (adding !! everywhere) has been discussed before. I don't think it's worth the trouble, so if you really care about the type, add !! to your code.

As for the offenses fixes, I fixed upstream due to conflicts. Thanks a lot for the PR.

@fnando fnando closed this Jul 15, 2019
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