money 3.5.2 → 3.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/CHANGELOG.md +7 -0
  2. data/lib/money/money.rb +2 -1
  3. metadata +3 -3
@@ -1,3 +1,10 @@
1
+ Money 3.5.3
2
+ ===========
3
+
4
+ Bugfixes
5
+ --------
6
+ - Fixed an error in #to_s when cents is negative
7
+
1
8
  Money 3.5.2
2
9
  ===========
3
10
 
@@ -907,7 +907,8 @@ class Money
907
907
  else
908
908
  Math.log10(currency.subunit_to_unit).to_s.to_i+1
909
909
  end
910
- unit, subunit = cents.divmod(currency.subunit_to_unit).map{|o| o.to_s}
910
+ unit, subunit = cents.abs.divmod(currency.subunit_to_unit).map{|o| o.to_s}
911
+ unit = (unit.to_i * -1).to_s if cents < 0
911
912
  return unit if decimal_places == 0
912
913
  subunit = (("0" * decimal_places) + subunit)[(-1*decimal_places)..-1]
913
914
  "#{unit}#{separator}#{subunit}"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: money
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 3
8
8
  - 5
9
- - 2
10
- version: 3.5.2
9
+ - 3
10
+ version: 3.5.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tobias Luetke