money 6.13.5 → 6.13.6
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/rates_store/memory.rb +11 -9
- data/lib/money/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f41d31f75d5bff854667ff0d38d23b7ffa7e40f4cc4be7732aed48303bf3c3e4
|
4
|
+
data.tar.gz: 9291b358b1ed9cf0fd5add31910735fcc4ce32d320068e8b3607c2e95e7dd108
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f3132b6ee0c2f4a4a49128a60316598da0e33f2fcfe9d123feac5f89f2498ffe2a166876ddfb9c628431e727fc2b88d40dc8f6660621a6ba269a36745f4ee92
|
7
|
+
data.tar.gz: a0ae9e326bea5273d4cb05849cf0efa30c7b210914bdca9a37ed56e5f4aece8d04f22715d326a751e5a9631d671e9bc4e6c04b1726b9b83d6c75feba9d0e094e
|
data/CHANGELOG.md
CHANGED
@@ -39,8 +39,8 @@ class Money
|
|
39
39
|
# store.add_rate("USD", "CAD", 1.24515)
|
40
40
|
# store.add_rate("CAD", "USD", 0.803115)
|
41
41
|
def add_rate(currency_iso_from, currency_iso_to, rate)
|
42
|
-
|
43
|
-
|
42
|
+
guard.synchronize do
|
43
|
+
rates[rate_key_for(currency_iso_from, currency_iso_to)] = rate
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -58,20 +58,20 @@ class Money
|
|
58
58
|
#
|
59
59
|
# store.get_rate("USD", "CAD") #=> 1.24515
|
60
60
|
def get_rate(currency_iso_from, currency_iso_to)
|
61
|
-
|
62
|
-
|
61
|
+
guard.synchronize do
|
62
|
+
rates[rate_key_for(currency_iso_from, currency_iso_to)]
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
66
|
def marshal_dump
|
67
|
-
|
68
|
-
return [self.class,
|
67
|
+
guard.synchronize do
|
68
|
+
return [self.class, options, rates.dup]
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
72
|
# Wraps block execution in a thread-safe transaction
|
73
73
|
def transaction(&block)
|
74
|
-
|
74
|
+
guard.synchronize do
|
75
75
|
yield
|
76
76
|
end
|
77
77
|
end
|
@@ -91,8 +91,8 @@ class Money
|
|
91
91
|
def each_rate(&block)
|
92
92
|
return to_enum(:each_rate) unless block_given?
|
93
93
|
|
94
|
-
|
95
|
-
|
94
|
+
guard.synchronize do
|
95
|
+
rates.each do |key, rate|
|
96
96
|
iso_from, iso_to = key.split(INDEX_KEY_SEPARATOR)
|
97
97
|
yield iso_from, iso_to, rate
|
98
98
|
end
|
@@ -101,6 +101,8 @@ class Money
|
|
101
101
|
|
102
102
|
private
|
103
103
|
|
104
|
+
attr_reader :rates, :options, :guard
|
105
|
+
|
104
106
|
# Return the rate hashkey for the given currencies.
|
105
107
|
#
|
106
108
|
# @param [String] currency_iso_from The currency to exchange from.
|
data/lib/money/version.rb
CHANGED
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.13.
|
4
|
+
version: 6.13.6
|
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: 2019-12-
|
12
|
+
date: 2019-12-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: i18n
|