-
Notifications
You must be signed in to change notification settings - Fork 41
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
nonzero? does not return a boolean #223
Comments
Looks like BigDecimal nonzero? doesn't return a Boolean but rather "Returns self if the value is non-zero, nil otherwise." https://ruby-doc.org/stdlib-2.5.1/libdoc/bigdecimal/rdoc/BigDecimal.html#method-i-nonzero-3F |
For comparison, [20] pry(main)> Money.new(0, 'USD').zero?
=> true
[21] pry(main)> Money.new(1, 'USD').zero?
=> false
[22] pry(main)> Money.new(-1, 'USD').zero?
=> false |
I filed a bug against BigDecimal as well: ruby/bigdecimal#181 |
Quoting from ruby/bigdecimal#181 (comment)
It seems Money is not handling this correctly by delegating to BigDecimal and should override this method to return a Money. |
Yeah either return a Money to remain consistent with BigDecimal's semantics, or I would expect |
The text was updated successfully, but these errors were encountered: