money 6.8.0 → 6.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/money/money/constructors.rb +2 -1
- data/lib/money/money/formatting.rb +6 -2
- data/lib/money/version.rb +1 -1
- data/spec/money/constructors_spec.rb +12 -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: 15096aaaa1d4cd7f33b54b6763c3ee1fa35dbe30
|
4
|
+
data.tar.gz: e8907ecf8a282428ae9f9da1f183acc2d615e508
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ffc7e4ebb66b8fe190add39f17fa26536d7e5de5e2130fa7d56c01a624ec7886671fe6ad389dd1d661721e168fa738ade3a44671e8616b9dfb83131fb121a99
|
7
|
+
data.tar.gz: 76fbc5414418ccd7bce8e41c7baf481daf29574a641957274c20c830e338030795011a61f33d7c50daa9c3587f36eca1fdf1c51283535e719dd25ee3958a89a1
|
data/CHANGELOG.md
CHANGED
@@ -205,6 +205,10 @@ class Money
|
|
205
205
|
rules = default_formatting_rules.merge(rules)
|
206
206
|
rules = localize_formatting_rules(rules)
|
207
207
|
rules = translate_formatting_rules(rules) if rules[:translate]
|
208
|
+
|
209
|
+
thousands_separator = self.thousands_separator
|
210
|
+
decimal_mark = self.decimal_mark
|
211
|
+
|
208
212
|
escaped_decimal_mark = Regexp.escape(decimal_mark)
|
209
213
|
|
210
214
|
if fractional == 0
|
@@ -288,11 +292,11 @@ class Money
|
|
288
292
|
end
|
289
293
|
|
290
294
|
def thousands_separator
|
291
|
-
|
295
|
+
i18n_format_for(:thousands_separator, :delimiter, ",")
|
292
296
|
end
|
293
297
|
|
294
298
|
def decimal_mark
|
295
|
-
|
299
|
+
i18n_format_for(:decimal_mark, :separator, ".")
|
296
300
|
end
|
297
301
|
|
298
302
|
alias_method :delimiter, :thousands_separator
|
data/lib/money/version.rb
CHANGED
@@ -7,6 +7,18 @@ describe Money::Constructors do
|
|
7
7
|
expect(Money.empty).to eq Money.new(0)
|
8
8
|
end
|
9
9
|
|
10
|
+
it "memoizes the result" do
|
11
|
+
expect(Money.empty.object_id).to eq Money.empty.object_id
|
12
|
+
end
|
13
|
+
|
14
|
+
it "memoizes a result for each currency" do
|
15
|
+
expect(Money.empty(:cad).object_id).to eq Money.empty(:cad).object_id
|
16
|
+
end
|
17
|
+
|
18
|
+
it "doesn't allow money to be modified for a currency" do
|
19
|
+
expect(Money.empty).to be_frozen
|
20
|
+
end
|
21
|
+
|
10
22
|
it "instantiates a subclass when inheritance is used" do
|
11
23
|
special_money_class = Class.new(Money)
|
12
24
|
expect(special_money_class.empty).to be_a special_money_class
|
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.8.
|
4
|
+
version: 6.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane Emmons
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|