mobility 1.0.3 → 1.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21ca551cdc17159c12fc493282038fba6e5274bd0ff56f5cd9d95a5bb1080cff
4
- data.tar.gz: 611ff563e7e3139c5db31ff1337a40082a9ed5e04349a87e748754cf32779817
3
+ metadata.gz: 4e614b2354ec6cfbc7d4b3d946beabc5214904c21432cceb0b78530ca389184e
4
+ data.tar.gz: fa9e5cf7097b92a203e38e07617254e42d3bc11f58254b4b13b359639b70902a
5
5
  SHA512:
6
- metadata.gz: 88a9c728d973e58532241802e2f2b99fc1b6d95b5d41d41ff87b9818378294b6795f8d8461600047aa4b3d4024e7e557a4e7ef0738fc99474a8dc741c91ee459
7
- data.tar.gz: 34a4ab6a5db631eb4e4fcddf519825e25e8efbec533ad1b9b92e4fdae7085149f29d25978a8c121b71ed701ed18db6de410ff2ddd157896364f379b215d98262
6
+ metadata.gz: ef1653434cb1e303f0496c9fecd810ea2d2772009dca94358949e293157e6f2a58341867ad6c117a5dc91469002acdd80b969d442126a7df95ea49f667360cc8
7
+ data.tar.gz: dceae9f7039d21bcd5d68a0a2f54515b39c0b8ab871c7386fe0834a88f973e91af5c27f48a85cdfe0d6479a8291a976abfee2208e16a116c4d75b03db54a8f87
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -21,6 +21,11 @@
21
21
  v1.0](https://github.com/shioyama/mobility/wiki/Introduction-to-Mobility-v1.0)
22
22
  for more details on how to upgrade.
23
23
 
24
+ ### 1.0.4
25
+ - Correctly override default backend options, fixes
26
+ [#492](https://github.com/shioyama/mobility/issues/492)
27
+ ([#495](https://github.com/shioyama/mobility/pull/495))
28
+
24
29
  ### 1.0.3
25
30
  - Fix `Mobility.default_backend`
26
31
  ([#497](https://github.com/shioyama/mobility/pull/497))
data/README.md CHANGED
@@ -56,7 +56,7 @@ To use the latest pre-version of Mobility 1.0, add this line to your
56
56
  application's Gemfile:
57
57
 
58
58
  ```ruby
59
- gem 'mobility', '~> 1.0.3'
59
+ gem 'mobility', '~> 1.0.4'
60
60
  ```
61
61
 
62
62
  ### ActiveRecord (Rails)
@@ -33,13 +33,6 @@ Defines:
33
33
  def initialize(*args, **original_options)
34
34
  super
35
35
 
36
- # Validate that the default backend from config has valid keys
37
- if (default = self.class.defaults[:backend])
38
- name, backend_options = default
39
- extra_keys = backend_options.keys - backend.valid_keys
40
- raise InvalidOptionKey, "These are not valid #{name} backend keys: #{extra_keys.join(', ')}." unless extra_keys.empty?
41
- end
42
-
43
36
  include InstanceMethods
44
37
  end
45
38
 
@@ -87,7 +80,7 @@ Defines:
87
80
 
88
81
  case options[:backend]
89
82
  when String, Symbol, Class
90
- @backend, @backend_options = options[:backend], options
83
+ @backend, @backend_options = options[:backend], options.dup
91
84
  when Array
92
85
  @backend, @backend_options = options[:backend]
93
86
  @backend_options = @backend_options.merge(original_options)
@@ -105,6 +98,14 @@ Defines:
105
98
  def validate_options(options)
106
99
  return super unless backend
107
100
  super(options.slice(*(options.keys - backend.valid_keys)))
101
+
102
+ # Validate that the default backend from config has valid keys, or if
103
+ # it is overridden by an array input that the array has valid keys.
104
+ if options[:backend].is_a?(Array)
105
+ name, backend_options = options[:backend]
106
+ extra_keys = backend_options.keys - backend.valid_keys
107
+ raise InvalidOptionKey, "These are not valid #{name} backend keys: #{extra_keys.join(', ')}." unless extra_keys.empty?
108
+ end
108
109
  end
109
110
 
110
111
  # Override default argument-handling in DSL to store kwargs passed along
@@ -8,7 +8,7 @@ module Mobility
8
8
  module VERSION
9
9
  MAJOR = 1
10
10
  MINOR = 0
11
- TINY = 3
11
+ TINY = 4
12
12
  PRE = nil
13
13
 
14
14
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mobility
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Salzberg
@@ -34,7 +34,7 @@ cert_chain:
34
34
  gSQml7TqcC6dZRsZRwYqzD9kUwdAJoCqno2CBUKs2l0yQAjFT36lRrVJznb7uWwa
35
35
  xpPFnsrtyaZW6Dty8TSG3qzmeGpmpIotA8x1VA==
36
36
  -----END CERTIFICATE-----
37
- date: 2021-01-24 00:00:00.000000000 Z
37
+ date: 2021-01-31 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: request_store
metadata.gz.sig CHANGED
Binary file