money 1.4 → 1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,7 @@
1
1
  class NoExchangeBank# :nodoc:
2
2
 
3
3
  def reduce(money, currency)
4
+ return money if money.currency == currency
4
5
  raise Money::MoneyError.new("Current Money::bank does not support money exchange. Please implement a bank object that does and assign it to the Money class.")
5
6
  end
6
7
 
data/lib/money/money.rb CHANGED
@@ -66,16 +66,16 @@ class Money
66
66
  end
67
67
 
68
68
  def +(other_money)
69
- if currency == other_money.currency
70
- Money.new(cents + other_money.cents,currency)
69
+ if self.cents == 0 or currency == other_money.currency
70
+ Money.new(cents + other_money.cents, other_money.currency)
71
71
  else
72
72
  Money.new(cents + other_money.exchange_to(currency).cents,currency)
73
73
  end
74
74
  end
75
75
 
76
76
  def -(other_money)
77
- if currency == other_money.currency
78
- Money.new(cents - other_money.cents, currency)
77
+ if self.cents == 0 or currency == other_money.currency
78
+ Money.new(cents - other_money.cents, other_money.currency)
79
79
  else
80
80
  Money.new(cents - other_money.exchange_to(currency).cents, currency)
81
81
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.10
3
3
  specification_version: 1
4
4
  name: money
5
5
  version: !ruby/object:Gem::Version
6
- version: "1.4"
7
- date: 2005-06-13
6
+ version: "1.5"
7
+ date: 2005-07-20
8
8
  summary: Class aiding in the handling of Money.
9
9
  require_paths:
10
10
  - lib