rails-on-sorbet 0.3.6 → 0.5.0
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 +4 -4
- data/.ruby-version +1 -0
- data/CHANGELOG.md +14 -0
- data/README.md +3 -0
- data/lib/rails/on/sorbet/map.rb +1 -1
- data/lib/rails/on/sorbet/version.rb +1 -1
- data/lib/tapioca/dsl/compilers/rails_on_sorbet_active_record_serializer.rb +3 -3
- data/rbi/map.rbi +2 -0
- data/rbi/typed_relation.rbi +9 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3ea28926ab10cc0fcae86ab5b28f3f0edcb837c108b2dce06dc4a0630dcf5b87
|
|
4
|
+
data.tar.gz: 6dd9264a458700cb250c6c75314475ed542f84bc4d9dcfa7dffe040db8939984
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a7ce2795b1153542782e7b62764c71af68d7dbbf62fb0eed0b4b626d112d585ef70901138a88c8d6309649d7df5d8e769e5d2c15b4525e1207948c0819638e4b
|
|
7
|
+
data.tar.gz: ccd02ca4092d27b855f657847d89facf82f8a3737bbba890343095a84a4acfbb2d9d4f46796f0f0adeded61e1709a28cf0b8a040eb39082c230f02af29de1aaa
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.4.7
|
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.5.0] - 30.12.2025
|
|
16
|
+
|
|
17
|
+
[Diff](https://github.com/espago/rails-on-sorbet/compare/v0.4.0...v0.5.0)
|
|
18
|
+
|
|
19
|
+
### Changes
|
|
20
|
+
- Add missing methods to `TypedRelation`
|
|
21
|
+
|
|
22
|
+
## [0.4.0] - 22.10.2025
|
|
23
|
+
|
|
24
|
+
[Diff](https://github.com/espago/rails-on-sorbet/compare/v0.3.6...v0.4.0)
|
|
25
|
+
|
|
26
|
+
### Changes
|
|
27
|
+
- Add `Map::Params` alias for `Map[String | Symbol, untyped]`
|
|
28
|
+
|
|
15
29
|
## [0.3.6] - 21.10.2025
|
|
16
30
|
|
|
17
31
|
[Diff](https://github.com/espago/rails-on-sorbet/compare/v0.3.5...v0.3.6)
|
data/README.md
CHANGED
|
@@ -85,6 +85,9 @@ m = Map(params) #=> Map[String, untyped]
|
|
|
85
85
|
foo(m) # OK
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
+
There is a `Map::Params` alias for the result of converting `ActionController::Parameters` and
|
|
89
|
+
`ActiveSupport::HashWithIndifferentAccess` to `Map`: `Map[String | Symbol, untyped]`.
|
|
90
|
+
|
|
88
91
|
### TypedRelation
|
|
89
92
|
|
|
90
93
|
Sorbet lacks proper generic handling of `ActiveRecord::Relation`.
|
data/lib/rails/on/sorbet/map.rb
CHANGED
|
@@ -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
|
|
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)
|
|
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)
|
|
36
36
|
setter_type.to_s
|
|
37
37
|
else
|
|
38
38
|
"T.nilable(#{setter_type})"
|
data/rbi/map.rbi
CHANGED
|
@@ -36,6 +36,8 @@ def Map(val); end
|
|
|
36
36
|
module Map
|
|
37
37
|
extend T::Generic
|
|
38
38
|
|
|
39
|
+
Params = T.type_alias { Map[T.any(String, Symbol), T.untyped] }
|
|
40
|
+
|
|
39
41
|
# Returns a new array populated with the keys from this hash. See also
|
|
40
42
|
# [`Hash#values`](https://docs.ruby-lang.org/en/2.7.0/Hash.html#method-i-values).
|
|
41
43
|
#
|
data/rbi/typed_relation.rbi
CHANGED
|
@@ -3,14 +3,23 @@
|
|
|
3
3
|
#: (ActiveRecord::Relation) -> TypedRelation[untyped]
|
|
4
4
|
def TypedRelation(val); end
|
|
5
5
|
|
|
6
|
+
# @requires_ancestor: Object
|
|
6
7
|
# @abstract
|
|
7
8
|
module TypedCommonRelationMethods
|
|
8
9
|
extend T::Generic
|
|
10
|
+
include Enumerable[Elem]
|
|
9
11
|
|
|
10
12
|
Elem = type_member(:out)
|
|
11
13
|
|
|
12
14
|
# START CommonRelationMethods
|
|
13
15
|
|
|
16
|
+
sig { returns(T::Boolean) }
|
|
17
|
+
def blank?; end
|
|
18
|
+
|
|
19
|
+
sig { params(blk: T.proc.params(arg0: Elem).void).returns(T.untyped) }
|
|
20
|
+
sig { returns(T::Enumerator[Elem]) }
|
|
21
|
+
def each(&blk); end
|
|
22
|
+
|
|
14
23
|
sig { abstract.returns(T::Array[Elem]) }
|
|
15
24
|
def to_a; end
|
|
16
25
|
|
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.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mateusz Drewniak
|
|
@@ -59,6 +59,7 @@ executables: []
|
|
|
59
59
|
extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
|
61
61
|
files:
|
|
62
|
+
- ".ruby-version"
|
|
62
63
|
- CHANGELOG.md
|
|
63
64
|
- LICENSE
|
|
64
65
|
- README.md
|
|
@@ -105,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
105
106
|
- !ruby/object:Gem::Version
|
|
106
107
|
version: '0'
|
|
107
108
|
requirements: []
|
|
108
|
-
rubygems_version: 3.
|
|
109
|
+
rubygems_version: 3.7.2
|
|
109
110
|
specification_version: 4
|
|
110
111
|
summary: A Rails extension that expands support for sorbet
|
|
111
112
|
test_files: []
|