lib/big_money.rb in big_money-1.2.0 vs lib/big_money.rb in big_money-1.2.1
- old
+ new
@@ -76,9 +76,17 @@
raise ArgumentError.new("Unknown +currency+ '#{currency.inspect}'.") unless Currency.default?
@currency = Currency.default
end
end
+ def zero?
+ amount.zero?
+ end
+
+ def nonzero?
+ amount.nonzero? && self
+ end
+
def <=>(money)
money.kind_of?(self.class) ? (currency <=> money.currency).nonzero? || (amount <=> money.amount).nonzero? || 0 : nil
end
def eql?(money)