smart_params 5.0.0 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/smart_params/field.rb +4 -0
- data/lib/smart_params/version.rb +1 -1
- data/lib/smart_params.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cf4e5cc079291eb9eeaad6ca13e2a79d0bbf15b2c606060e996dd2e05425442
|
4
|
+
data.tar.gz: 8a6fdf59b26cc8f385bb449be28dba4e5fe0841fda0f1f3bdc0e1cebfcbaf1c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73d1158ecfcd1b49da42ac85991fc9673be357e7b012716aa9981fef5cc14dc0d9592280b1443029c3c924f22bcaeb2de759a3d158f0fbe2cf876393aa7b13a6
|
7
|
+
data.tar.gz: cb248bd6442bcab659cec87bc8e74daeb8c1304cb73009a2559b81d580276ba84392097692f6bbbc621f796826c0dfeba850ba49e62de657ca5ed817aff1aa17
|
data/lib/smart_params/field.rb
CHANGED
@@ -119,6 +119,10 @@ module SmartParams
|
|
119
119
|
@subfields << self.class.new(key:, keychain: [*keychain, key], type:, nullable:, subschema:, &subfield)
|
120
120
|
end
|
121
121
|
|
122
|
+
private def subschema(key, nullable: false, &subfield)
|
123
|
+
field(key, subschema: true, type: SmartParams::Hash, nullable:, &subfield)
|
124
|
+
end
|
125
|
+
|
122
126
|
# Very busy method with recent changes. TODO: clean-up
|
123
127
|
private def dug(raw)
|
124
128
|
return raw if keychain.empty?
|
data/lib/smart_params/version.rb
CHANGED
data/lib/smart_params.rb
CHANGED
@@ -100,9 +100,9 @@ module SmartParams
|
|
100
100
|
end
|
101
101
|
|
102
102
|
class_methods do
|
103
|
-
def schema(name: :default,
|
103
|
+
def schema(name: :default, &definitions)
|
104
104
|
@schema ||= {}
|
105
|
-
@schema[name] = Field.new(keychain: [], type
|
105
|
+
@schema[name] = Field.new(keychain: [], type: SmartParams::Hash, subschema: false, &definitions)
|
106
106
|
end
|
107
107
|
end
|
108
108
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_params
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kurtis Rainbolt-Greene
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|