barsoom / attr_extras

Takes some boilerplate out of Ruby with methods like attr_initialize.
MIT License
560 stars 31 forks source link

Fix calling without argument warnings #31

Closed JuanitoFatas closed 4 years ago

JuanitoFatas commented 4 years ago

Hello, this Pull Request has 2 changes:

These calling without arguments warnings introduced by https://github.com/ruby/ruby/commit/2993b24a1ecc5fa3cc9f140bfd80669c3a3b7b9c from ruby bug tracker #13249.

I‘m not a fan of adding this if, but \_(ツ)_/.

Open to better suggestion, thanks!

henrik commented 4 years ago

Thank you! We were about to look into this but this saves us the trouble :)

I tried running the tests with this change on Ruby 2.5.1 and 2.6.5, and it didn't show a "private attribute?" warning (even with RUBYOPT=-w rake), so it seems it's OK for at least those two as well.

henrik commented 4 years ago

We changed it to a guard :) https://github.com/barsoom/attr_extras/commit/1305e6cd4517ee7b6ebb31695099edd01e007a2a