paramore 3.1.0 → 3.1.1

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: 9a617acfe047478a8c2082a94ad5151d3701bcc3ba964f1ccb0269242583e7c0
4
- data.tar.gz: ec1c58dd29e93bd0c931d6b9d422c3333888c112a4d6726f7e4833d7f7b90f8f
3
+ metadata.gz: fb73686fb48a297c559c211476f565f8aba18a2e93a10936b75cacd4eab2bcb2
4
+ data.tar.gz: df12fd5715e1c4e3851a1ed2f9748f24cccec9d9ccc817c7b6ba74960370f426
5
5
  SHA512:
6
- metadata.gz: f451b20d3078e38ffd716c8d186206a72e63287eb98a8c2a5832f9e8ced549371b90faf57450e97eb38d31b002f96ea6948af0b61612273624317028ac7fe720
7
- data.tar.gz: 47b62333f92a8f925e2f8d6319a0c23baefa6e97840fc57634323824a05023d651798025981f4ab81764b646a86eaefc21b006ea627b3faba0ea6bd6eee2a451
6
+ metadata.gz: 5d7f2e6f52065f18ebb5b7d51577950ceb234db5f5a21fd3a20fdb987066c451da22beda1bc86a4101ad9bfaf4ccf195a38b1281b02c92c4d8cc2d1fa6602958
7
+ data.tar.gz: b5dd8ae054488a628c580924cfdfb0355ef063a43eb7e46fe249ae9ecad62a4a80d5603b4eed182d1b69c1d691926c97165c605b11d05eec4b5ed66efbc3cac3
@@ -4,17 +4,7 @@ module Paramore
4
4
  module CastParameters
5
5
  module_function
6
6
  def run(field, data)
7
- recursive_merge(cast(field, data, 'data'))
8
- end
9
-
10
- def recursive_merge(nested_hash_array)
11
- nested_hash_array.reduce(:merge).map do |name, value|
12
- if value.is_a?(Array) && value.all? { |_value| _value.is_a?(Hash) }
13
- { name => recursive_merge(value) }
14
- else
15
- { name => value }
16
- end
17
- end.reduce(:merge)
7
+ cast(field, data, 'data')
18
8
  end
19
9
 
20
10
  def cast(field, value, name = nil)
@@ -37,15 +27,15 @@ module Paramore
37
27
  end
38
28
 
39
29
  def typecast_hash(field, hash)
40
- field.map do |name, field|
41
- { name => cast(field, hash[name], name) }
42
- end
30
+ field.to_h { |name, field| [name, cast(field, hash[name], name)] }
43
31
  end
44
32
 
45
33
  def typecast_array(field, array)
46
34
  array
47
35
  .reject { |unit| unit.to_s == '' && field.compact? }
48
- .map { |unit| typecast_value(field.type.first, unit) }
36
+ .map do |unit|
37
+ cast(Paramore.field(field.type.first, null: true), unit)
38
+ end
49
39
  end
50
40
 
51
41
  def typecast_value(type, value)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paramore
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Kairevičius
@@ -101,7 +101,7 @@ licenses:
101
101
  - MIT
102
102
  metadata: {}
103
103
  post_install_message: |
104
- Thank you for installing Paramore 3.1.0 !
104
+ Thank you for installing Paramore 3.1.1 !
105
105
  From the command line you can run `paramore` to generate a configuration file
106
106
 
107
107
  More details here : https://github.com/lumzdas/paramore/blob/master/README.md
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  - !ruby/object:Gem::Version
121
121
  version: '0'
122
122
  requirements: []
123
- rubygems_version: 3.2.3
123
+ rubygems_version: 3.0.8
124
124
  signing_key:
125
125
  specification_version: 4
126
126
  summary: A declarative approach to Rails' strong parameter typing and sanitizing