stronger_parameters 2.13.0 → 2.14.0

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
2
  SHA256:
3
- metadata.gz: 598d8d30678b80a1fff8224887b69dacd1975b8c3849f123961b3514a643e6e3
4
- data.tar.gz: d80b6fa97333c507ab7e2282ed78e22260c352f528d50f434340afdd206b2c3a
3
+ metadata.gz: ca4cebd1c17a7cb7e68ae01c2fa676c492ab16cbf11998e563e0520c7c0f3bc5
4
+ data.tar.gz: 5a2b40548e74d16db1cdc99426bc44db551c2430a1c1bad8e2425566e18cff43
5
5
  SHA512:
6
- metadata.gz: b8f5201eeb8a1eb53a58f6eaacae23d40f08dcdb28da8ba9c650f607c19d126e5eea951a788fedc6cd82f0b4e9a020385952662ea6f44655f65e0c992e89b6e4
7
- data.tar.gz: 932b7e76c8d86afefe1aa9d5cfdbf9af19ea2f784ed678e469bebde5761cd6317fd39075e86a029cc13ed5f2ce1a4fe3221775c48f4ff765db30e86e74593bfe
6
+ metadata.gz: 13c0e6268b1a9e6567f874c131a038b947047f277db0f581d8f775da9da23ff2170fc1a3a8df8bcd1bedb21cfbbb030f89a4ec55685956be3e4e48176ee20f72
7
+ data.tar.gz: 0eee3ab73de87a06429c6a86242261fc3344d267de36aa26c2921c594aeed36866ac939b303254927cafd284edca2f05408a81b04ea2393fbc89621dd9a07a19
@@ -6,7 +6,7 @@ module StrongerParameters
6
6
  def value(v)
7
7
  if v.is_a?(Integer)
8
8
  return v
9
- elsif v.is_a?(String) && v =~ /\A-?\d+\Z/
9
+ elsif v.is_a?(String) && v.strip =~ /\A-?\d+\Z/
10
10
  return v.to_i
11
11
  end
12
12
 
@@ -15,9 +15,7 @@ module StrongerParameters
15
15
  when Array
16
16
  ActionController::Parameters.array(*value.map { |v| sugar(v) })
17
17
  when Hash
18
- constraints = value.each_with_object({}) do |(key, v), memo|
19
- memo[key] = sugar(v)
20
- end
18
+ constraints = value.transform_values { |v| sugar(v) }
21
19
  ActionController::Parameters.map(constraints)
22
20
  else
23
21
  value
@@ -63,8 +61,7 @@ module StrongerParameters
63
61
  return :skip if for_action == :skip
64
62
 
65
63
  # FYI: we should be able to call sugar on the result of deep_merge, but it breaks tests
66
- permit_parameters[:all].deep_merge(for_action).
67
- each_with_object({}) { |(k, v), a| a[k] = PermittedParameters.sugar(v) }
64
+ permit_parameters[:all].deep_merge(for_action).transform_values { |v| PermittedParameters.sugar(v) }
68
65
  end
69
66
 
70
67
  private
@@ -139,9 +139,8 @@ module StrongerParameters
139
139
 
140
140
  hash_filter_without_stronger_parameters(params, other_filter)
141
141
 
142
- stronger_filter.keys.each do |key|
142
+ stronger_filter.each_key do |key|
143
143
  value = fetch(key, nil)
144
- result = nil
145
144
 
146
145
  if value.nil? && self.class.allow_nil_for_everything
147
146
  params[key] = nil if key?(key)
@@ -198,5 +197,5 @@ module StrongerParameters
198
197
  end
199
198
  end
200
199
 
201
- ActionController::Parameters.send :include, StrongerParameters::Parameters
202
- ActionController::Base.send :include, StrongerParameters::ControllerSupport
200
+ ActionController::Parameters.include StrongerParameters::Parameters
201
+ ActionController::Base.include StrongerParameters::ControllerSupport
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module StrongerParameters
3
- VERSION = '2.13.0'
3
+ VERSION = '2.14.0'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stronger_parameters
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.13.0
4
+ version: 2.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mick Staugaard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-21 00:00:00.000000000 Z
11
+ date: 2021-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: minitest
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: minitest-rails
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +53,7 @@ dependencies:
67
53
  - !ruby/object:Gem::Version
68
54
  version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
- name: minitest-around
56
+ name: maxitest
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - ">="
@@ -81,7 +67,7 @@ dependencies:
81
67
  - !ruby/object:Gem::Version
82
68
  version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
- name: minitest-rg
70
+ name: bump
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
73
  - - ">="
@@ -95,7 +81,7 @@ dependencies:
95
81
  - !ruby/object:Gem::Version
96
82
  version: '0'
97
83
  - !ruby/object:Gem::Dependency
98
- name: bump
84
+ name: single_cov
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
87
  - - ">="
@@ -109,7 +95,7 @@ dependencies:
109
95
  - !ruby/object:Gem::Version
110
96
  version: '0'
111
97
  - !ruby/object:Gem::Dependency
112
- name: single_cov
98
+ name: rubocop
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
101
  - - ">="
@@ -123,7 +109,7 @@ dependencies:
123
109
  - !ruby/object:Gem::Version
124
110
  version: '0'
125
111
  - !ruby/object:Gem::Dependency
126
- name: rubocop
112
+ name: mocha
127
113
  requirement: !ruby/object:Gem::Requirement
128
114
  requirements:
129
115
  - - ">="
@@ -137,7 +123,7 @@ dependencies:
137
123
  - !ruby/object:Gem::Version
138
124
  version: '0'
139
125
  - !ruby/object:Gem::Dependency
140
- name: mocha
126
+ name: forking_test_runner
141
127
  requirement: !ruby/object:Gem::Requirement
142
128
  requirements:
143
129
  - - ">="
@@ -220,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
206
  - !ruby/object:Gem::Version
221
207
  version: '0'
222
208
  requirements: []
223
- rubygems_version: 3.1.3
209
+ rubygems_version: 3.0.3.1
224
210
  signing_key:
225
211
  specification_version: 4
226
212
  summary: Type checking and type casting of parameters for Action Pack