money 6.11.1 → 6.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d1d4f4df8ad562014dbb4ae22806844149097c84
4
- data.tar.gz: cd1dfde292d4ce67beb09c59d0c793f6b2f99e83
3
+ metadata.gz: 839ee653922ffdc788d8e2228cb5a1abb45ba8d0
4
+ data.tar.gz: 4b088a1a439eb25e919e7866d27d4c005a34820e
5
5
  SHA512:
6
- metadata.gz: 1ef2ea4a84d5f2ac90b2dd189aac326d4149412a85c4a8bd70d3fa55237a0bcc610cb5b410b96d1d2c97a613e34ed94189216afed15718f081385ffca5d1545d
7
- data.tar.gz: a83595b34a6947923d0f4fc7cf8ecaadd7ef3d46f41840fb65c28d616312259610e1c6ce0be584dde111b3aab903f6a294feac1745788a2e661784daceb44569
6
+ metadata.gz: 63c6e4d523b63113dc36c0d243700611078fa16649a12d04cb1a48f8be30cc9799a59363fcb53c71b20d3d94bdfe0eaafe0b72dbe372b99430203d7b24bb25da
7
+ data.tar.gz: bb0848ba4f66abac84545a718671d0e7aee2a0a2d836ef4607a2ff807e61cce5cf24324c835b32b59e4773c64bacf6e0f743422798fbf07b9ca43358902923e8
@@ -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
@@ -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
@@ -1,3 +1,3 @@
1
1
  class Money
2
- VERSION = '6.11.1'
2
+ VERSION = '6.11.2'
3
3
  end
@@ -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.1
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-04-30 00:00:00.000000000 Z
11
+ date: 2018-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n