shopify-money 0.11.5 → 0.11.6

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
- SHA1:
3
- metadata.gz: 9441b8dab64b7077e0d960f6a81dc069c283ac90
4
- data.tar.gz: 3fddaf1c805956ee9ca67c9295047698dfeb19f3
2
+ SHA256:
3
+ metadata.gz: c122266eee7c568beac30f07b25eb000fec13b3b516f64d86b2a2a7fe0e062cb
4
+ data.tar.gz: 9462466de4c1d0d1fbaadbc4ad84bb26a53bbc2559369442c54c50aba6287fe6
5
5
  SHA512:
6
- metadata.gz: d3c7e5ff1f9ac0a66bbcf0097f5cfdc5c7fa2b202d499850ab5c6620dcece9d96936c3b1e9a8abd6c387be910b8c92d7ef42263755752b4766dcedbac187546e
7
- data.tar.gz: 36ac7078e3b1960f91d399517c468c29c62744a1068525c23263c4401ab075aae0be8c6e7f166e64050be2a1d6d78dfdcb3f26daab97000a97493a2e3bf41464
6
+ metadata.gz: a2972d4815fb48705773b50a0561e2cd4c662c53e42f05627220def37d01a25de850234c965c4b25fd47a8d3980b173c5ebc17724671bbb95c278bf1cfe52b14
7
+ data.tar.gz: 00d5a604adf5bd570378e424238a3977f3602b276a3c1d84bff2670853bd59eb27d9db2cac5e39b0208fb91e11f163b18e2ab2d40a90b86d656511e1ce9421d8
@@ -0,0 +1,2 @@
1
+ enabled:
2
+ - cla
@@ -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
- num.times do |index|
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
@@ -1,3 +1,3 @@
1
1
  class Money
2
- VERSION = "0.11.5"
2
+ VERSION = "0.11.6"
3
3
  end
@@ -54,13 +54,16 @@ module MoneyColumn
54
54
  return self[column] = Money.new(money, currency_raw_source).value
55
55
  end
56
56
 
57
- currency_source = currency_raw_source ? Money::Helpers.value_to_currency(currency_raw_source) : Money::NULL_CURRENCY
58
- unless currency_source.compatible?(money.currency)
59
- Money.deprecate("[money_column] currency mismatch between #{currency_source} and #{money.currency}.")
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
@@ -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 if changed but will show a deprecation notice' do
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.5
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-10-18 00:00:00.000000000 Z
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.14
182
+ rubygems_version: 2.7.6
182
183
  signing_key:
183
184
  specification_version: 4
184
185
  summary: Shopify's money gem