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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72ea358328d6d2de0b7cb159c3f7a02eaeeba1114428d0dd1eef74033311a4b5
4
- data.tar.gz: 3b864136adce02b4393645f42e56f46086b4a7b0b8a1e75a326ffcb0ab3a6b49
3
+ metadata.gz: 0cf4e5cc079291eb9eeaad6ca13e2a79d0bbf15b2c606060e996dd2e05425442
4
+ data.tar.gz: 8a6fdf59b26cc8f385bb449be28dba4e5fe0841fda0f1f3bdc0e1cebfcbaf1c5
5
5
  SHA512:
6
- metadata.gz: b6020bd0591d343040c21882a091e6bb9535132f116e6c538ea60edbe4f7da15581dafae6158d37fe81d0aa52f920827e416af88fdd25e4ea9e6da182a719096
7
- data.tar.gz: 20c54169633985ed7febf49f4b5028c0b375017f793d6a3f0ee172ea9ce41e72869ec745cc5e6e854fdd4f6c3ae989e80cce6806f3b1e286e6e8be92c8f45c10
6
+ metadata.gz: 73d1158ecfcd1b49da42ac85991fc9673be357e7b012716aa9981fef5cc14dc0d9592280b1443029c3c924f22bcaeb2de759a3d158f0fbe2cf876393aa7b13a6
7
+ data.tar.gz: cb248bd6442bcab659cec87bc8e74daeb8c1304cb73009a2559b81d580276ba84392097692f6bbbc621f796826c0dfeba850ba49e62de657ca5ed817aff1aa17
@@ -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?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SmartParams
4
- VERSION = "5.0.0"
4
+ VERSION = "5.1.0"
5
5
  end
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, type: Hash, subschema: false, &definitions)
103
+ def schema(name: :default, &definitions)
104
104
  @schema ||= {}
105
- @schema[name] = Field.new(keychain: [], type:, subschema:, &definitions)
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.0.0
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-09-18 00:00:00.000000000 Z
11
+ date: 2023-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport