<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>CHANGELOG</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -19,15 +19,8 @@ class String
     
     # Get the cents amount
     matches = scan /(\-?\d+(\.(\d+))?)/
-    cents = matches[0] ? (matches[0][0].to_f * 100).round : 0
+    cents = matches[0] ? (matches[0][0].to_f * 100) : 0
     
     Money.new(cents, currency)
   end
 end
-
-# Allow writing of Nil.to_money =&gt; Money.empty
-class NilClass
-  def to_money
-    Money.empty
-  end  
-end
\ No newline at end of file</diff>
      <filename>lib/money/core_extensions.rb</filename>
    </modified>
    <modified>
      <diff>@@ -49,7 +49,7 @@ class Money
   # Alternativly you can use the convinience methods like 
   # Money.ca_dollar and Money.us_dollar 
   def initialize(cents, currency = default_currency)
-    @cents, @currency = cents, currency
+    @cents, @currency = cents.round, currency
   end
 
   # Do two money objects equal? Only works if both objects are of the same currency
@@ -101,6 +101,11 @@ class Money
   def /(fixnum)
     Money.new(cents / fixnum, currency)    
   end
+  
+  # Test if the money amount is zero
+  def zero?
+    cents == 0 
+  end
 
 
   # Format the price according to several rules</diff>
      <filename>lib/money/money.rb</filename>
    </modified>
    <modified>
      <diff>@@ -24,7 +24,9 @@ class CoreExtensionsTest &lt; Test::Unit::TestCase
   end
   
   def test_nil
-    assert_equal Money.empty, nil.to_money
+    assert_raise(NoMethodError) do
+      nil.to_money
+    end
   end
 
 end
\ No newline at end of file</diff>
      <filename>tests/core_extensions_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -50,6 +50,12 @@ class MoneyTest &lt; Test::Unit::TestCase
     end   
   end
   
+  def test_zero
+    assert_equal true, Money.empty.zero?
+    assert_equal false, Money.ca_dollar(1).zero?
+    assert_equal false, Money.ca_dollar(-1).zero?
+  end
+  
   def test_real_exchange   
     Money.bank = VariableExchangeBank.new
     Money.bank.add_rate(&quot;USD&quot;, &quot;CAD&quot;, 1.24515)</diff>
      <filename>tests/money_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>bc1dc608bb6ec485771fdbeccb940740cb275f10</id>
    </parent>
  </parents>
  <author>
    <name>tobi</name>
    <email>tobi@da9ee5fb-4aef-0310-b2bf-b6c93f260786</email>
  </author>
  <url>http://github.com/collectiveidea/money/commit/6ba47892a17f5c295af63e625e17202a50b26f51</url>
  <id>6ba47892a17f5c295af63e625e17202a50b26f51</id>
  <committed-date>2006-01-15T08:48:34-08:00</committed-date>
  <authored-date>2006-01-15T08:48:34-08:00</authored-date>
  <message>added money.zero?, removed nil.to_money


git-svn-id: svn://leetsoft.com/money/trunk@14 da9ee5fb-4aef-0310-b2bf-b6c93f260786</message>
  <tree>c2540f9e3be1598eb046879f105597a3cb0587ee</tree>
  <committer>
    <name>tobi</name>
    <email>tobi@da9ee5fb-4aef-0310-b2bf-b6c93f260786</email>
  </committer>
</commit>
