money 6.11.1 → 6.11.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/money/money.rb +2 -1
- data/lib/money/money/formatting_rules.rb +1 -1
- data/lib/money/version.rb +1 -1
- data/spec/money_spec.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 839ee653922ffdc788d8e2228cb5a1abb45ba8d0
|
4
|
+
data.tar.gz: 4b088a1a439eb25e919e7866d27d4c005a34820e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63c6e4d523b63113dc36c0d243700611078fa16649a12d04cb1a48f8be30cc9799a59363fcb53c71b20d3d94bdfe0eaafe0b72dbe372b99430203d7b24bb25da
|
7
|
+
data.tar.gz: bb0848ba4f66abac84545a718671d0e7aee2a0a2d836ef4607a2ff807e61cce5cf24324c835b32b59e4773c64bacf6e0f743422798fbf07b9ca43358902923e8
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 6.11.2
|
4
|
+
- Fix regression: ignore formatting defaults for Money#to_s
|
5
|
+
|
6
|
+
## 6.11.1
|
7
|
+
- Fix issue with adding non-USD money to zero (used when calling `.sum` on an array)
|
8
|
+
|
3
9
|
## 6.11.0
|
4
10
|
- Support i18n 1.0
|
5
11
|
- Update yard dependency to 0.9.11
|
data/lib/money/money.rb
CHANGED
@@ -354,7 +354,8 @@ class Money
|
|
354
354
|
format decimal_mark: currency.decimal_mark,
|
355
355
|
thousands_separator: '',
|
356
356
|
no_cents_if_whole: currency.decimal_places == 0,
|
357
|
-
symbol: false
|
357
|
+
symbol: false,
|
358
|
+
ignore_defaults: true
|
358
359
|
end
|
359
360
|
|
360
361
|
# Return the amount of money as a BigDecimal.
|
@@ -8,7 +8,7 @@ class Money
|
|
8
8
|
# support for old format parameters
|
9
9
|
@rules = normalize_formatting_rules(raw_rules)
|
10
10
|
|
11
|
-
@rules = default_formatting_rules.merge(@rules)
|
11
|
+
@rules = default_formatting_rules.merge(@rules) unless @rules[:ignore_defaults]
|
12
12
|
@rules = localize_formatting_rules(@rules)
|
13
13
|
@rules = translate_formatting_rules(@rules) if @rules[:translate]
|
14
14
|
end
|
data/lib/money/version.rb
CHANGED
data/spec/money_spec.rb
CHANGED
@@ -482,6 +482,15 @@ YAML
|
|
482
482
|
expect(Money.new(10_00, "BRL").to_s).to eq "10,00"
|
483
483
|
end
|
484
484
|
|
485
|
+
context "with defaults set" do
|
486
|
+
before { Money.default_formatting_rules = { with_currency: true } }
|
487
|
+
after { Money.default_formatting_rules = nil }
|
488
|
+
|
489
|
+
it "ignores defaults" do
|
490
|
+
expect(Money.new(10_00, 'USD').to_s).to eq '10.00'
|
491
|
+
end
|
492
|
+
end
|
493
|
+
|
485
494
|
context "with infinite_precision", :infinite_precision do
|
486
495
|
it "shows fractional cents" do
|
487
496
|
expect(Money.new(1.05, "USD").to_s).to eq "0.0105"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: money
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.11.
|
4
|
+
version: 6.11.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane Emmons
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|