typed_params 1.1.0 → 1.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: 532f36036d10c99438c7764f96edee2a81609957e91549be1d39c09eeac3b986
4
- data.tar.gz: 2780ca74ef0c99371dc87486134e37b25c8de93a4814f297d7d1955fab18ba32
3
+ metadata.gz: ab9149f0354b3110bc3a5610b06785055ad0e3ec00cc5e352b2daef7be902178
4
+ data.tar.gz: a48c899da8bc5d9fa9ee1041a2e35ff8f2f942b9ff083f7bf42e18e34e7813a2
5
5
  SHA512:
6
- metadata.gz: 52d65870463fa00390b94bb2b469f3c12dda164518d4a32ed3151c5f09303ceb546ab4fcc76388eb0c42902a19a64ba249eb44119492ab771175c876821e0d7e
7
- data.tar.gz: cd70318ed475aa00a8cbdafc89656957a93abe17c1108b0d39bca744102a1e91546d483168b8e5a9e8ac1ae9b58bb17870594d8611b8a05d46d46862f744d7ae
6
+ metadata.gz: 4dabec975049677e23ab38f91c121f8f83a2dab36b753c9ad58f0693ad31ce780122b503b4b7554f6afe36568e3a85ef8c4d559591a8205bbadc9740e5cfd4b9
7
+ data.tar.gz: a4c8be23f0472002c9e317924091b624ac7cd640f08bfc515f61db119b72d20d6312919a4f45b31b14560d8bde08dad55467be058422acd4f39e225b927fd539
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.1
4
+
5
+ - Fix compatibility with Ruby 3.3.0 due to [#20091](https://bugs.ruby-lang.org/issues/20091).
6
+
7
+ ## 1.1.0
8
+
9
+ - Add memoization to `#typed_params` and `#typed_query` methods.
10
+
3
11
  ## 1.0.3
4
12
 
5
13
  - Revert 0b0aaa6b66edd3e4c3336e51fa340592e7ef9e86.
@@ -18,4 +26,4 @@
18
26
 
19
27
  ## 0.2.0
20
28
 
21
- - Test release.
29
+ - Test release.
data/README.md CHANGED
@@ -110,6 +110,7 @@ _We're working on improving the docs._
110
110
  - Reuse schemas across controllers by defining named schemas.
111
111
  - Run validations on params, similar to active model validations.
112
112
  - Run transforms on params before they hit your controller.
113
+ - Support formatters such as JSON:API.
113
114
 
114
115
  ## Usage
115
116
 
@@ -47,7 +47,7 @@ module TypedParams
47
47
  # │ 1 ││ 2 │ │ 5 │
48
48
  # └───┘└───┘ └───┘
49
49
  #
50
- def depth_first_map(param, &)
50
+ def depth_first_map(param, &block)
51
51
  return if param.nil?
52
52
 
53
53
  # Postorder DFS, so we'll visit the children first.
@@ -55,12 +55,12 @@ module TypedParams
55
55
  case param.schema.children
56
56
  in Array if param.array?
57
57
  if param.schema.indexed?
58
- param.schema.children.each_with_index { |v, i| self.class.call(param[i], schema: v, controller:, &) }
58
+ param.schema.children.each_with_index { |v, i| self.class.call(param[i], schema: v, controller:, &block) }
59
59
  else
60
- param.value.each { |v| self.class.call(v, schema: param.schema.children.first, controller:, &) }
60
+ param.value.each { |v| self.class.call(v, schema: param.schema.children.first, controller:, &block) }
61
61
  end
62
62
  in Hash if param.hash?
63
- param.schema.children.each { |k, v| self.class.call(param[k], schema: v, controller:, &) }
63
+ param.schema.children.each { |k, v| self.class.call(param[k], schema: v, controller:, &block) }
64
64
  else
65
65
  end
66
66
  end
@@ -34,7 +34,7 @@ module TypedParams
34
34
  end
35
35
 
36
36
  klass.singleton_class.send(:alias_method, :"unmemoized_#{method_name}", method_name)
37
- klass.class_eval <<-RUBY, __FILE__, __LINE__ + 1
37
+ klass.class_eval <<~RUBY, __FILE__, __LINE__ + 1
38
38
  def self.#{method_name}(*args, **kwargs, &block)
39
39
  key = args.hash ^ kwargs.hash ^ block.hash
40
40
 
@@ -72,7 +72,7 @@ module TypedParams
72
72
  end
73
73
 
74
74
  klass.alias_method :"unmemoized_#{method_name}", method_name
75
- klass.class_eval <<-RUBY, __FILE__, __LINE__ + 1
75
+ klass.class_eval <<~RUBY, __FILE__, __LINE__ + 1
76
76
  def #{method_name}(*args, **kwargs, &block)
77
77
  key = args.hash ^ kwargs.hash ^ block.hash
78
78
 
@@ -211,7 +211,7 @@ module TypedParams
211
211
 
212
212
  ##
213
213
  # params defines multiple like-parameters for a hash schema.
214
- def params(*keys, **kwargs, &) = keys.each { param(_1, **kwargs, &) }
214
+ def params(*keys, **kwargs, &block) = keys.each { param(_1, **kwargs, &block) }
215
215
 
216
216
  ##
217
217
  # item defines an indexed parameter for an array schema.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TypedParams
4
- VERSION = '1.1.0'
4
+ VERSION = '1.1.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typed_params
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zeke Gabrielse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-17 00:00:00.000000000 Z
11
+ date: 2024-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails