shopify-money 0.11.5 → 0.11.6
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 +5 -5
- data/.github/probots.yml +2 -0
- data/lib/money/money.rb +1 -6
- data/lib/money/version.rb +1 -1
- data/lib/money_column/active_record_hooks.rb +7 -4
- data/spec/money_column_spec.rb +1 -2
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: c122266eee7c568beac30f07b25eb000fec13b3b516f64d86b2a2a7fe0e062cb
|
|
4
|
+
data.tar.gz: 9462466de4c1d0d1fbaadbc4ad84bb26a53bbc2559369442c54c50aba6287fe6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a2972d4815fb48705773b50a0561e2cd4c662c53e42f05627220def37d01a25de850234c965c4b25fd47a8d3980b173c5ebc17724671bbb95c278bf1cfe52b14
|
|
7
|
+
data.tar.gz: 00d5a604adf5bd570378e424238a3977f3602b276a3c1d84bff2670853bd59eb27d9db2cac5e39b0208fb91e11f163b18e2ab2d40a90b86d656511e1ce9421d8
|
data/.github/probots.yml
ADDED
data/lib/money/money.rb
CHANGED
|
@@ -346,13 +346,8 @@ class Money
|
|
|
346
346
|
high = Money.from_subunits(low.subunits + 1, currency)
|
|
347
347
|
|
|
348
348
|
remainder = subunits % num
|
|
349
|
-
result = []
|
|
350
349
|
|
|
351
|
-
|
|
352
|
-
result[index] = index < remainder ? high : low
|
|
353
|
-
end
|
|
354
|
-
|
|
355
|
-
return result
|
|
350
|
+
return Array.new(remainder, high) + Array.new(num - remainder, low)
|
|
356
351
|
end
|
|
357
352
|
|
|
358
353
|
# Clamps the value to be within the specified minimum and maximum. Returns
|
data/lib/money/version.rb
CHANGED
|
@@ -54,13 +54,16 @@ module MoneyColumn
|
|
|
54
54
|
return self[column] = Money.new(money, currency_raw_source).value
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
if options[:currency_read_only]
|
|
58
|
+
currency_source = Money::Helpers.value_to_currency(currency_raw_source)
|
|
59
|
+
if currency_raw_source && !money.currency.compatible?(currency_source)
|
|
60
|
+
Money.deprecate("[money_column] currency mismatch between #{currency_source} and #{money.currency}.")
|
|
61
|
+
end
|
|
62
|
+
else
|
|
63
|
+
self[options[:currency_column]] = money.currency.to_s unless money.no_currency?
|
|
60
64
|
end
|
|
61
65
|
|
|
62
66
|
self[column] = money.value
|
|
63
|
-
self[options[:currency_column]] = money.currency.to_s unless options[:currency_read_only] || money.no_currency?
|
|
64
67
|
end
|
|
65
68
|
|
|
66
69
|
module ClassMethods
|
data/spec/money_column_spec.rb
CHANGED
|
@@ -139,9 +139,8 @@ RSpec.describe 'MoneyColumn' do
|
|
|
139
139
|
expect(record.currency.to_s).to eq('EUR')
|
|
140
140
|
end
|
|
141
141
|
|
|
142
|
-
it 'does overwrite a currency
|
|
142
|
+
it 'does overwrite a currency' do
|
|
143
143
|
expect(record.currency.to_s).to eq('EUR')
|
|
144
|
-
expect(Money).to receive(:deprecate).once
|
|
145
144
|
record.update(price: Money.new(4, 'JPY'))
|
|
146
145
|
expect(record.currency.to_s).to eq('JPY')
|
|
147
146
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: shopify-money
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.11.
|
|
4
|
+
version: 0.11.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shopify Inc
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
11
|
+
date: 2018-12-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -116,6 +116,7 @@ extensions: []
|
|
|
116
116
|
extra_rdoc_files: []
|
|
117
117
|
files:
|
|
118
118
|
- ".document"
|
|
119
|
+
- ".github/probots.yml"
|
|
119
120
|
- ".gitignore"
|
|
120
121
|
- ".rspec"
|
|
121
122
|
- ".travis.yml"
|
|
@@ -178,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
178
179
|
version: '0'
|
|
179
180
|
requirements: []
|
|
180
181
|
rubyforge_project:
|
|
181
|
-
rubygems_version: 2.6
|
|
182
|
+
rubygems_version: 2.7.6
|
|
182
183
|
signing_key:
|
|
183
184
|
specification_version: 4
|
|
184
185
|
summary: Shopify's money gem
|