nofxx-money 2.3.9 → 2.3.10
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +5 -5
- data/lib/money/money.rb +2 -1
- data/money.gemspec +1 -1
- data/spec/money/money_spec.rb +19 -2
- metadata +3 -2
data/README.rdoc
CHANGED
@@ -93,12 +93,12 @@ If you use Rails, then environment.rb is a very good place to put this.
|
|
93
93
|
|
94
94
|
=== Autofetch rates
|
95
95
|
|
96
|
-
By default, Money won't fetch the rates automatically, you need to call: @
|
96
|
+
By default, Money won't fetch the rates automatically, you need to call: @some_bank.fetch_rates
|
97
97
|
|
98
98
|
If you have your bank default rates configured, it'll fetch all possible rates from it,
|
99
99
|
if you don't, It'll fetch all rates to and from your default_currency.
|
100
100
|
|
101
|
-
Money uses the ECB XML Feed.
|
101
|
+
Money uses the ECB XML Feed. (http://ecb.int)
|
102
102
|
|
103
103
|
|
104
104
|
== Webapps
|
@@ -149,6 +149,6 @@ Orinally developed by:
|
|
149
149
|
|
150
150
|
This branch is part of:
|
151
151
|
|
152
|
-
|
153
|
-
|
154
|
-
|
152
|
+
* http://github.com/bobek/money
|
153
|
+
* http://github.com/nofxx/money
|
154
|
+
* http://github.com/ShadowBelmove/money
|
data/lib/money/money.rb
CHANGED
@@ -47,6 +47,7 @@ class Money
|
|
47
47
|
"HKD" => { :delimiter => ",", :separator => ".", :symbol => "$" },
|
48
48
|
"SGD" => { :delimiter => ",", :separator => ".", :symbol => "$" },
|
49
49
|
"BRL" => { :delimiter => ".", :separator => ",", :symbol => "R$" },
|
50
|
+
"ZWD" => { :delimiter => ",", :separator => ".", :symbol => "Z$"},
|
50
51
|
"EUR" => { :delimiter => ",", :separator => ".", :symbol => '€', :html => '€' },
|
51
52
|
"GBP" => { :delimiter => ",", :separator => ".", :symbol => '£', :html => '£' },
|
52
53
|
"JPY" => { :delimiter => ".", :separator => ".", :symbol => '¥', :html => '¥' },
|
@@ -254,7 +255,7 @@ class Money
|
|
254
255
|
if rules[:symbol]
|
255
256
|
symbol = rules[:symbol]
|
256
257
|
else
|
257
|
-
symbol = ""
|
258
|
+
symbol = "$"
|
258
259
|
end
|
259
260
|
else
|
260
261
|
symbol = (CURRENCIES[currency] ? CURRENCIES[currency][:symbol] : "$")
|
data/money.gemspec
CHANGED
data/spec/money/money_spec.rb
CHANGED
@@ -191,17 +191,30 @@ describe Money do
|
|
191
191
|
|
192
192
|
describe "Format out " do
|
193
193
|
|
194
|
+
describe "Symbols" do
|
195
|
+
before(:each) do
|
196
|
+
@one = Proc.new { |cur| Money.new(100, cur).format }
|
197
|
+
end
|
198
|
+
it { @one["BRL"].should eql "R$1,00" }
|
199
|
+
it { @one["USD"].should eql "$1.00" }
|
200
|
+
it { @one["EUR"].should eql "€1.00" }
|
201
|
+
it { @one["CAD"].should eql "$1.00" }
|
202
|
+
it { @one["HKD"].should eql "$1.00" }
|
203
|
+
it { @one["SGD"].should eql "$1.00" }
|
204
|
+
it { @one["ZWD"].should eql "Z$1.00" }
|
205
|
+
it { @one["GBP"].should eql "£1.00" }
|
206
|
+
it { @one["JPY"].should eql "¥1.00" }
|
207
|
+
end
|
208
|
+
|
194
209
|
describe "Options" do
|
195
210
|
before(:each) do
|
196
211
|
@cash = Money.new(2_00, "JPY")
|
197
212
|
end
|
198
|
-
|
199
213
|
it { @cash.format.should eql("¥2.00") }
|
200
214
|
it { @cash.format(:symbol => "R$ ").should eql("R$ 2.00") }
|
201
215
|
it { @cash.format(:no_cents => true).should eql("¥2") }
|
202
216
|
it { @cash.format(:no_cents => true, :symbol => "R$ ").should eql("R$ 2") }
|
203
217
|
it { @cash.format(:html => true).should eql("¥2.00") }
|
204
|
-
|
205
218
|
end
|
206
219
|
|
207
220
|
it { Money.new(0).format.should eql("$0.00") }
|
@@ -222,6 +235,10 @@ describe Money do
|
|
222
235
|
it { Money.new(80000000000, "CAD").format.should eql("$800,000,000.00") }
|
223
236
|
it { Money.new(880000000000, "GBP").format(:no_cents => true).should eql("£8,800,000,000") }
|
224
237
|
it { Money.new(8800000000088, "EUR").format.should eql("€88,000,000,000.88") }
|
238
|
+
it { Money.new("10000", "BRL").format.should eql("R$100,00") }
|
239
|
+
it { Money.new("10000", "USD").format.should eql("$100.00") }
|
240
|
+
it { "10,000.00 USD".to_money.format.should eql("$10,000.00") }
|
241
|
+
it { "10,000.00 BRL".to_money.format.should eql("R$10.000,00") }
|
225
242
|
|
226
243
|
it "should fail nicely if symbol can`t be found" do
|
227
244
|
Money.stub!(:default_currency).and_return("XXX")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nofxx-money
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Money Team
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- tmp/.gitignore
|
49
49
|
has_rdoc: false
|
50
50
|
homepage: http://github.com/nofxx/money
|
51
|
+
licenses:
|
51
52
|
post_install_message:
|
52
53
|
rdoc_options:
|
53
54
|
- --charset=UTF-8
|
@@ -68,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
69
|
requirements: []
|
69
70
|
|
70
71
|
rubyforge_project:
|
71
|
-
rubygems_version: 1.
|
72
|
+
rubygems_version: 1.3.5
|
72
73
|
signing_key:
|
73
74
|
specification_version: 3
|
74
75
|
summary: This library aids one in handling money and different currencies.
|