rails-on-sorbet 0.2.5 → 0.2.7

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: 016ee79f514564579ebd4e3474c02b5be8688118fa8568375f05ec6d926cf341
4
- data.tar.gz: 40ba4c07fe8653c2b6f02d99993eb8ecb142fdc449b62f5a9f5fe9c0ee1553a7
3
+ metadata.gz: 9c4cb80ad204ac1ff75b170054b6c3722eaab381d2c707eaa04e9ae937bc7e39
4
+ data.tar.gz: 2796d4d8a2ac13e1d30618aa60016208201349df01f4ebcdf8d4af3fd84fe020
5
5
  SHA512:
6
- metadata.gz: 980834c8e826c03693ac7d5b2e9798e8af38e98f37f677f8e27158adc9889d6fcbcbec6863b961a140deabe3a9ac99bf41e5397d610590b5d861fcf68c6de7d1
7
- data.tar.gz: a9c0d7cbcce07bc618e46bd79707da22456818a6c324cf57b4cdb3e8a6f854a23a9e2c2a9f8b881fc75357c23bc5a4cd1324c1901aa7f453b9f0a20f0d736097
6
+ metadata.gz: c30c27cc7e051c159e5f8af119cc48862410974a4808af8dac082d3a9be5aa56802bf5aa9c12d13ba43d274a554f33dd88fc65c60a181ab46089a95d07206d59
7
+ data.tar.gz: fd0d8cdd737a867e9fe269a76823626b1040f643710e7aa56090b39411eaed24310d9d11bcc7593de9c8c03d4c5ca3aa5d430302c5fea0cea3f6ce505449f515
data/CHANGELOG.md CHANGED
@@ -12,6 +12,20 @@ Add changes in new features here. Do not change the gem's version in pull/merge
12
12
  ### Changes
13
13
  -
14
14
 
15
+ ## [0.2.7] - 08.10.2025
16
+
17
+ [Diff](https://github.com/espago/rails-on-sorbet/compare/v0.2.6...v0.2.7)
18
+
19
+ ### Changes
20
+ - Improve signatures of `Map#include?`, `Map#key?`, `Map#[]`, `Map#value?`,`Hash#include?`, `Hash#key?`, `Hash#[]`, `Hash#value?`, `Set#include?`
21
+
22
+ ## [0.2.6] - 02.10.2025
23
+
24
+ [Diff](https://github.com/espago/rails-on-sorbet/compare/v0.2.5...v0.2.6)
25
+
26
+ ### Changes
27
+ - Add missing `T::Generic`
28
+
15
29
  ## [0.2.0] - 18.09.2025
16
30
 
17
31
  [Diff](https://github.com/espago/rails-on-sorbet/compare/v0.1.1...v0.2.0)
@@ -3,7 +3,7 @@
3
3
  module Rails
4
4
  module On
5
5
  module Sorbet
6
- VERSION = '0.2.5'
6
+ VERSION = '0.2.7'
7
7
  end
8
8
  end
9
9
  end
@@ -21,18 +21,18 @@ module Tapioca
21
21
  def decorate
22
22
  root.create_path(constant) do |klass|
23
23
  constant._sorbet_serializer_definitions.sort.each do |name, definition|
24
- return_type = definition.return_type || definition.coder.try(:return_type) || T.untyped
24
+ return_type = definition.return_type || definition.coder.try(:return_type) || T.untyped # rubocop:disable Sorbet/ForbidTUntyped
25
25
  setter_type = definition.setter_type || definition.coder.try(:setter_type) || return_type
26
26
 
27
27
  return_type_string =
28
- if return_type == T.unsafe(T.untyped)
28
+ if return_type == T.unsafe(T.untyped) # rubocop:disable Sorbet/ForbidTUnsafe,Sorbet/ForbidTUntyped
29
29
  return_type.to_s
30
30
  else
31
31
  "T.nilable(#{return_type})"
32
32
  end
33
33
 
34
34
  setter_type_string =
35
- if setter_type == T.unsafe(T.untyped)
35
+ if setter_type == T.unsafe(T.untyped) # rubocop:disable Sorbet/ForbidTUnsafe,Sorbet/ForbidTUntyped
36
36
  setter_type.to_s
37
37
  else
38
38
  "T.nilable(#{setter_type})"
data/rbi/hash.rbi ADDED
@@ -0,0 +1,71 @@
1
+ # typed: false
2
+
3
+ class Hash
4
+ sig { params(object: T.anything).returns(T::Boolean) }
5
+ def exclude?(object); end
6
+
7
+ # Returns `true` if the given key is present in *hsh*.
8
+ #
9
+ # ```ruby
10
+ # h = { "a" => 100, "b" => 200 }
11
+ # h.has_key?("a") #=> true
12
+ # h.has_key?("z") #=> false
13
+ # ```
14
+ #
15
+ # Note that
16
+ # [`include?`](https://docs.ruby-lang.org/en/2.7.0/Hash.html#method-i-include-3F)
17
+ # and
18
+ # [`member?`](https://docs.ruby-lang.org/en/2.7.0/Hash.html#method-i-member-3F)
19
+ # do not test member equality using `==` as do other Enumerables.
20
+ #
21
+ # See also
22
+ # [`Enumerable#include?`](https://docs.ruby-lang.org/en/2.7.0/Enumerable.html#method-i-include-3F)
23
+ sig do
24
+ params(
25
+ arg0: T.anything,
26
+ )
27
+ .returns(T::Boolean)
28
+ end
29
+ def include?(arg0); end
30
+
31
+ sig do
32
+ params(
33
+ arg0: T.anything,
34
+ )
35
+ .returns(T::Boolean)
36
+ end
37
+ def key?(arg0); end
38
+
39
+ # Element Reference---Retrieves the *value* object corresponding to the *key*
40
+ # object. If not found, returns the default value (see
41
+ # [`Hash::new`](https://docs.ruby-lang.org/en/2.7.0/Hash.html#method-c-new)
42
+ # for details).
43
+ #
44
+ # ```ruby
45
+ # h = { "a" => 100, "b" => 200 }
46
+ # h["a"] #=> 100
47
+ # h["c"] #=> nil
48
+ # ```
49
+ sig do
50
+ params(
51
+ arg0: T.anything,
52
+ )
53
+ .returns(T.nilable(V))
54
+ end
55
+ def [](arg0); end
56
+
57
+ # Returns `true` if the given value is present for some key in *hsh*.
58
+ #
59
+ # ```ruby
60
+ # h = { "a" => 100, "b" => 200 }
61
+ # h.value?(100) #=> true
62
+ # h.value?(999) #=> false
63
+ # ```
64
+ sig do
65
+ params(
66
+ arg0: T.anything,
67
+ )
68
+ .returns(T::Boolean)
69
+ end
70
+ def value?(arg0); end
71
+ end
data/rbi/map.rbi CHANGED
@@ -8,6 +8,8 @@ def Map(val); end
8
8
  # @abstract
9
9
  #: [out K, out V]
10
10
  module Map
11
+ extend T::Generic
12
+
11
13
  # Returns a new array populated with the keys from this hash. See also
12
14
  # [`Hash#values`](https://docs.ruby-lang.org/en/2.7.0/Hash.html#method-i-values).
13
15
  #
@@ -26,7 +28,7 @@ module Map
26
28
  sig {abstract.returns(T::Boolean)}
27
29
  def empty?(); end
28
30
 
29
- sig { abstract.params(object: BasicObject).returns(T::Boolean) }
31
+ sig { abstract.params(object: T.anything).returns(T::Boolean) }
30
32
  def exclude?(object); end
31
33
 
32
34
  # Returns `true` if the given key is present in *hsh*.
@@ -47,7 +49,7 @@ module Map
47
49
  # [`Enumerable#include?`](https://docs.ruby-lang.org/en/2.7.0/Enumerable.html#method-i-include-3F)
48
50
  sig do
49
51
  abstract.params(
50
- arg0: K,
52
+ arg0: T.anything,
51
53
  )
52
54
  .returns(T::Boolean)
53
55
  end
@@ -111,7 +113,7 @@ module Map
111
113
 
112
114
  sig do
113
115
  abstract.params(
114
- arg0: K,
116
+ arg0: T.anything,
115
117
  )
116
118
  .returns(T::Boolean)
117
119
  end
@@ -288,7 +290,7 @@ module Map
288
290
  # ```
289
291
  sig do
290
292
  abstract.params(
291
- arg0: K,
293
+ arg0: T.anything,
292
294
  )
293
295
  .returns(T.nilable(V))
294
296
  end
@@ -751,7 +753,7 @@ module Map
751
753
  # ```
752
754
  sig do
753
755
  abstract.params(
754
- arg0: V,
756
+ arg0: T.anything,
755
757
  )
756
758
  .returns(T::Boolean)
757
759
  end
data/rbi/set.rbi ADDED
@@ -0,0 +1,25 @@
1
+ # typed: true
2
+
3
+ class Set
4
+ # sig { params(object: T.anything).returns(T::Boolean) }
5
+ # def exclude?(object); end
6
+
7
+ # Returns true if the set contains the given object.
8
+ # Note that `include?` and `member?` do not test
9
+ # member
10
+ # equality
11
+ # using `==` as do other Enumerables.
12
+ # See also
13
+ # [`Enumerable#include?`](https://docs.ruby-lang.org/en/2.7.0/Enumerable.html#method-i-include-3F)
14
+ #
15
+ # Also aliased as:
16
+ # [`member?`](https://docs.ruby-lang.org/en/2.7.0/Set.html#method-i-member-3F),
17
+ # [`===`](https://docs.ruby-lang.org/en/2.7.0/Set.html#method-i-3D-3D-3D)
18
+ sig do
19
+ params(
20
+ o: T.anything,
21
+ )
22
+ .returns(T::Boolean)
23
+ end
24
+ def include?(o); end
25
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-on-sorbet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mateusz Drewniak
@@ -77,8 +77,10 @@ files:
77
77
  - rbi/current_attributes.rbi
78
78
  - rbi/datetime.rbi
79
79
  - rbi/duration.rbi
80
+ - rbi/hash.rbi
80
81
  - rbi/map.rbi
81
82
  - rbi/numeric.rbi
83
+ - rbi/set.rbi
82
84
  homepage: https://github.com/espago/rails-on_sorbet
83
85
  licenses: []
84
86
  metadata: