money 6.16.0 → 6.17.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3de47437ec002ed24a400508cac96b2ff6812f484c666fe3db3a82e921a805c0
4
- data.tar.gz: f96755602e56ea81d734b7505e7cfc88caaa948d7a8d285eeb470801028c15b9
3
+ metadata.gz: a77a263720ab3ec11aa09efafd92db24699bb94a6c1dbde3ef4091919d4d9f6f
4
+ data.tar.gz: 740a688dd466867db5b75a12f6f937401097bfb3961a6767238cab977b6a6e18
5
5
  SHA512:
6
- metadata.gz: 2f8cd71611e96a80cb733651675cb6fac59d358cb7c9576c8c264abbfec6eb1da11b8cbe2af12cdfb070e5dd01cd74f6fdc70772da16aa4c2abc5248b13fca3c
7
- data.tar.gz: '092ba5a188eb29d462431e94420e1c6d7a7f9a4a59c0895f66a4a1cf92cfaa37cbc1bc344a241f5f8cc9fc4e998189164bc2d0ab11480a589fe7bb0e341754ba'
6
+ metadata.gz: ea34a12312f4dc1c356dd2feef065c282e0c4a6452ad9c85cb594dead220bd2cdd7fbe2294e9252f8ab4805f1c75f652572012ff28b93d3fccdf5f7738eeb0b7
7
+ data.tar.gz: cb819df21f0b5177c3f28ad20adc831dff9e153e51efb1077725eaa1f80e67446de8eb4bcb8e20600c52cde575c776cb6858b50d794874b955cac558d3de8896
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 6.17.0
4
+
5
+ - Allow true for `thousands_separator`
6
+
3
7
  ## 6.16.0
4
8
 
5
9
  - Add `Money.from_cents` alias as a more explicit initializer, it's the same as `Money.new`
@@ -124,11 +124,14 @@ class Money
124
124
  # the currency should be delimited by the specified character or ','
125
125
  #
126
126
  # @example
127
- # # If false is specified, no thousands_separator is used.
127
+ # # If a falsey value is specified, no thousands_separator is used.
128
128
  # Money.new(100000, "USD").format(thousands_separator: false) #=> "1000.00"
129
129
  # Money.new(100000, "USD").format(thousands_separator: nil) #=> "1000.00"
130
130
  # Money.new(100000, "USD").format(thousands_separator: "") #=> "1000.00"
131
131
  #
132
+ # # If true is specified, the locale or default thousands_separator is used.
133
+ # Money.new(100000, "USD").format(thousands_separator: true) #=> "1,000.00"
134
+ #
132
135
  # # If a string is specified, it's value is used.
133
136
  # Money.new(100000, "USD").format(thousands_separator: ".") #=> "$1.000.00"
134
137
  #
@@ -241,7 +244,11 @@ class Money
241
244
  end
242
245
 
243
246
  def thousands_separator
244
- lookup :thousands_separator
247
+ val = lookup :thousands_separator
248
+
249
+ return val unless val == true
250
+
251
+ lookup_default :thousands_separator
245
252
  end
246
253
 
247
254
  def decimal_mark
@@ -371,6 +378,10 @@ class Money
371
378
  def lookup(key)
372
379
  return rules[key] || DEFAULTS[key] if rules.has_key?(key)
373
380
 
381
+ lookup_default key
382
+ end
383
+
384
+ def lookup_default(key)
374
385
  (Money.locale_backend && Money.locale_backend.lookup(key, currency)) || DEFAULTS[key]
375
386
  end
376
387
 
data/lib/money/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Money
2
- VERSION = '6.16.0'
2
+ VERSION = '6.17.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: money
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.16.0
4
+ version: 6.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Emmons
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-05-09 00:00:00.000000000 Z
12
+ date: 2024-03-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: i18n
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  - !ruby/object:Gem::Version
160
160
  version: '0'
161
161
  requirements: []
162
- rubygems_version: 3.2.3
162
+ rubygems_version: 3.5.3
163
163
  signing_key:
164
164
  specification_version: 4
165
165
  summary: A Ruby Library for dealing with money and currency conversion.