more_money 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +2 -1
- data/lib/more_money/more_money.rb +2 -1
- data/lib/more_money/version.rb +1 -1
- data/test/more_money_test.rb +2 -3
- metadata +3 -3
data/CHANGELOG.txt
CHANGED
@@ -231,6 +231,7 @@ module MoreMoney
|
|
231
231
|
rules = rules.flatten
|
232
232
|
return CURRENCIES[currency][:format].call(cents, currency, CURRENCIES[currency][:symbol], rules) if CURRENCIES[currency][:format]
|
233
233
|
return DEFAULT_FORMATS[cents] if DEFAULT_FORMATS[cents]
|
234
|
+
return '' if cents.nil?
|
234
235
|
|
235
236
|
|
236
237
|
if rules.include?(:no_cents)
|
@@ -265,7 +266,7 @@ module MoreMoney
|
|
265
266
|
|
266
267
|
# Money.new(100, 'USD').to_s => "1.00"
|
267
268
|
def to_s
|
268
|
-
sprintf("%.2f", cents.to_f / 100 )
|
269
|
+
cents.nil? ? '' : sprintf("%.2f", cents.to_f / 100 )
|
269
270
|
end
|
270
271
|
|
271
272
|
# Recieve the amount of this money object in another currency
|
data/lib/more_money/version.rb
CHANGED
data/test/more_money_test.rb
CHANGED
@@ -71,6 +71,8 @@ class MoreMoneyTest < Test::Unit::TestCase
|
|
71
71
|
def test_nil
|
72
72
|
a = Money.new(nil)
|
73
73
|
assert_equal nil, a.cents
|
74
|
+
assert_equal '', a.to_s
|
75
|
+
assert_equal '', a.format
|
74
76
|
assert_equal 'USD', a.currency
|
75
77
|
assert_equal nil, (a * 2).cents
|
76
78
|
assert_equal nil, (a / 2).cents
|
@@ -83,9 +85,6 @@ class MoreMoneyTest < Test::Unit::TestCase
|
|
83
85
|
c = nil.to_money
|
84
86
|
assert_equal nil, c.cents
|
85
87
|
assert_equal 'USD', c.currency
|
86
|
-
end
|
87
|
-
|
88
|
-
def test_nil
|
89
88
|
a = ''.to_money
|
90
89
|
assert_equal nil, a.cents
|
91
90
|
a = '0'.to_money
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.2
|
3
3
|
specification_version: 1
|
4
4
|
name: more_money
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2007-02-
|
6
|
+
version: 0.0.9
|
7
|
+
date: 2007-02-13 00:00:00 +00:00
|
8
8
|
summary: handles money objects in any currency using just integer as backend
|
9
9
|
require_paths:
|
10
10
|
- lib
|