RubyMoney/money · error · ArgumentError
Money#== supports only zero numerics
Error message
Money#== supports only zero numerics
What it means
Error "Money#== supports only zero numerics" thrown in RubyMoney/money.
Source
Thrown at lib/money/money/arithmetic.rb:87
return other.is_a?(CoercedNumeric) ? 0 <=> fractional : fractional <=> 0
end
# Always allow comparison with zero
if zero? || other.zero?
return fractional <=> other.fractional
end
other = other.exchange_to(currency)
fractional <=> other.fractional
rescue Money::Bank::UnknownRate
nil
end
# Uses Comparable's implementation but raises ArgumentError if non-zero
# numeric value is given.
def ==(other)
if other.is_a?(Numeric) && !other.zero?
raise ArgumentError, "Money#== supports only zero numerics"
end
super
end
# Test if the amount is positive. Returns +true+ if the money amount is
# greater than 0, +false+ otherwise.
#
# @return [Boolean]
#
# @example
# Money.new(1).positive? #=> true
# Money.new(0).positive? #=> false
# Money.new(-1).positive? #=> false
def positive?
fractional > 0
end
View on GitHub (pinned to 26e2829c34)
When it happens
Trigger: Thrown at lib/money/money/arithmetic.rb:87 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of RubyMoney/money@26e2829c34 (2026-08-23).
Data as JSON: /api/errors/31c5e16ee81cb0fd.
Report an issue: GitHub.