activerecord-ejection_seat 0.3.0 → 0.3.2
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 -1
- data/.tool-versions +1 -1
- data/CHANGELOG.md +6 -0
- data/CODE_OF_CONDUCT.md +1 -1
- data/Gemfile +0 -2
- data/Gemfile.lock +44 -55
- data/README.md +19 -8
- data/lib/activerecord-ejection_seat/version.rb +1 -1
- data/sorbet/rbi/gems/{activerecord@7.0.4.1.rbi → activerecord@7.0.4.3.rbi} +128 -128
- data/sorbet/rbi/gems/{activesupport@7.0.4.1.rbi → activesupport@7.0.4.3.rbi} +79 -103
- data/sorbet/rbi/gems/{concurrent-ruby@1.1.10.rbi → concurrent-ruby@1.2.2.rbi} +1180 -1267
- data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +19 -0
- data/sorbet/rbi/gems/i18n@1.13.0.rbi +2320 -0
- data/sorbet/rbi/gems/{irb@1.6.2.rbi → irb@1.6.4.rbi} +44 -44
- data/sorbet/rbi/gems/json@2.6.3.rbi +65 -73
- data/sorbet/rbi/gems/{minitest@5.17.0.rbi → minitest@5.18.0.rbi} +79 -48
- data/sorbet/rbi/gems/{parallel@1.22.1.rbi → parallel@1.23.0.rbi} +75 -79
- data/sorbet/rbi/gems/{parser@3.2.0.0.rbi → parser@3.2.2.1.rbi} +760 -471
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +11 -6
- data/sorbet/rbi/gems/rake@13.0.6.rbi +141 -0
- data/sorbet/rbi/gems/rbi@0.0.16.rbi +17 -17
- data/sorbet/rbi/gems/{regexp_parser@2.6.1.rbi → regexp_parser@2.8.0.rbi} +962 -340
- data/sorbet/rbi/gems/rexml@3.2.5.rbi +57 -0
- data/sorbet/rbi/gems/{rubocop-ast@1.24.1.rbi → rubocop-ast@1.28.1.rbi} +165 -146
- data/sorbet/rbi/gems/{rubocop-minitest@0.26.1.rbi → rubocop-minitest@0.31.0.rbi} +456 -248
- data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +24 -50
- data/sorbet/rbi/gems/{rubocop-sorbet@0.6.11.rbi → rubocop-sorbet@0.7.0.rbi} +153 -124
- data/sorbet/rbi/gems/{rubocop@1.43.0.rbi → rubocop@1.51.0.rbi} +3237 -2084
- data/sorbet/rbi/gems/{ruby-progressbar@1.11.0.rbi → ruby-progressbar@1.13.0.rbi} +382 -277
- data/sorbet/rbi/gems/sorbet-struct-comparable@1.3.0.rbi +18 -0
- data/sorbet/rbi/gems/{spoom@1.1.15.rbi → spoom@1.2.1.rbi} +621 -501
- data/sorbet/rbi/gems/{tapioca@0.10.5.rbi → tapioca@0.11.6.rbi} +293 -207
- data/sorbet/rbi/gems/{thor@1.2.1.rbi → thor@1.2.2.rbi} +76 -61
- data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +5917 -0
- data/sorbet/rbi/gems/{yard-sorbet@0.8.0.rbi → yard-sorbet@0.8.1.rbi} +13 -26
- data/sorbet/rbi/gems/{yard@0.9.28.rbi → yard@0.9.34.rbi} +1531 -345
- metadata +34 -40
- data/activerecord-ejection_seat.gemspec +0 -40
- data/sorbet/rbi/gems/i18n@1.12.0.rbi +0 -8
- data/sorbet/rbi/gems/language_server-protocol@3.17.0.2.rbi +0 -8
- data/sorbet/rbi/gems/prettier_print@1.2.0.rbi +0 -8
- data/sorbet/rbi/gems/ruby-lsp@0.3.8.rbi +0 -14
- data/sorbet/rbi/gems/syntax_tree@5.2.0.rbi +0 -8
- data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +0 -8
- data/sorbet/rbi/gems/webrick@1.7.0.rbi +0 -2498
- /data/sorbet/rbi/gems/{activemodel@7.0.4.1.rbi → activemodel@7.0.4.3.rbi} +0 -0
- /data/sorbet/rbi/gems/{reline@0.3.2.rbi → reline@0.3.3.rbi} +0 -0
- /data/sorbet/rbi/gems/{sqlite3@1.6.0.rbi → sqlite3@1.6.2.rbi} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cb7f22b1d3c090b3e6f5bd6770f6505eb35270849ab15453803d59542689856
|
4
|
+
data.tar.gz: a2b95dec8ff6a4af2c5eccac2aa83e05b2679fb31168e119c663f409e4648f31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 980c251cd7200718c60cebb5d7b0598498640a6dde7d6baa4e0aebb757db329179cc47d9d593c6d4ad35dcc0c4d4f1698ebab5d98856b2968986766ccc3dd540
|
7
|
+
data.tar.gz: 5ca07098815a2f1b94944e8a71dc9f47aefc9024d312f72b4fa4d62537f6f2203e8359e10783bcde68e9b61aa1b240b793ecb4de692dbc9191b74690adae22d1
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.2.
|
1
|
+
3.2.2
|
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby 3.2.
|
1
|
+
ruby 3.2.2
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [0.3.2] - 2023-05-16
|
10
|
+
|
11
|
+
### Security
|
12
|
+
|
13
|
+
- Updates dependencies
|
14
|
+
|
9
15
|
## [0.1.0] - 2022-07-22
|
10
16
|
### Added
|
11
17
|
- Adds `.ejects_to` to `ActiveRecord::Base` that can be used to specify a Sorbet `T::Struct` that can be converted for that model.
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -39,7 +39,7 @@ This Code of Conduct applies within all community spaces, and also applies when
|
|
39
39
|
|
40
40
|
## Enforcement
|
41
41
|
|
42
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at maxveldink@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
43
43
|
|
44
44
|
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
45
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,42 +1,40 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
activerecord-ejection_seat (0.3.
|
4
|
+
activerecord-ejection_seat (0.3.2)
|
5
5
|
activerecord (>= 6.0)
|
6
6
|
sorbet-runtime
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activemodel (7.0.4.
|
12
|
-
activesupport (= 7.0.4.
|
13
|
-
activerecord (7.0.4.
|
14
|
-
activemodel (= 7.0.4.
|
15
|
-
activesupport (= 7.0.4.
|
16
|
-
activesupport (7.0.4.
|
11
|
+
activemodel (7.0.4.3)
|
12
|
+
activesupport (= 7.0.4.3)
|
13
|
+
activerecord (7.0.4.3)
|
14
|
+
activemodel (= 7.0.4.3)
|
15
|
+
activesupport (= 7.0.4.3)
|
16
|
+
activesupport (7.0.4.3)
|
17
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
18
|
i18n (>= 1.6, < 2)
|
19
19
|
minitest (>= 5.1)
|
20
20
|
tzinfo (~> 2.0)
|
21
21
|
ast (2.4.2)
|
22
|
-
concurrent-ruby (1.
|
23
|
-
debug (1.
|
22
|
+
concurrent-ruby (1.2.2)
|
23
|
+
debug (1.8.0)
|
24
24
|
irb (>= 1.5.0)
|
25
25
|
reline (>= 0.3.1)
|
26
26
|
diff-lcs (1.5.0)
|
27
|
-
i18n (1.
|
27
|
+
i18n (1.13.0)
|
28
28
|
concurrent-ruby (~> 1.0)
|
29
29
|
io-console (0.6.0)
|
30
|
-
irb (1.6.
|
30
|
+
irb (1.6.4)
|
31
31
|
reline (>= 0.3.0)
|
32
32
|
json (2.6.3)
|
33
|
-
|
34
|
-
minitest (5.17.0)
|
33
|
+
minitest (5.18.0)
|
35
34
|
netrc (0.11.0)
|
36
|
-
parallel (1.
|
37
|
-
parser (3.2.
|
35
|
+
parallel (1.23.0)
|
36
|
+
parser (3.2.2.1)
|
38
37
|
ast (~> 2.4.1)
|
39
|
-
prettier_print (1.2.0)
|
40
38
|
rainbow (3.1.1)
|
41
39
|
rake (13.0.6)
|
42
40
|
rbi (0.0.16)
|
@@ -44,72 +42,64 @@ GEM
|
|
44
42
|
parser (>= 2.6.4.0)
|
45
43
|
sorbet-runtime (>= 0.5.9204)
|
46
44
|
unparser
|
47
|
-
regexp_parser (2.
|
48
|
-
reline (0.3.
|
45
|
+
regexp_parser (2.8.0)
|
46
|
+
reline (0.3.3)
|
49
47
|
io-console (~> 0.5)
|
50
48
|
rexml (3.2.5)
|
51
|
-
rubocop (1.
|
49
|
+
rubocop (1.51.0)
|
52
50
|
json (~> 2.3)
|
53
51
|
parallel (~> 1.10)
|
54
52
|
parser (>= 3.2.0.0)
|
55
53
|
rainbow (>= 2.2.2, < 4.0)
|
56
54
|
regexp_parser (>= 1.8, < 3.0)
|
57
55
|
rexml (>= 3.2.5, < 4.0)
|
58
|
-
rubocop-ast (>= 1.
|
56
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
59
57
|
ruby-progressbar (~> 1.7)
|
60
58
|
unicode-display_width (>= 2.4.0, < 3.0)
|
61
|
-
rubocop-ast (1.
|
62
|
-
parser (>= 3.
|
63
|
-
rubocop-minitest (0.
|
64
|
-
rubocop (>=
|
59
|
+
rubocop-ast (1.28.1)
|
60
|
+
parser (>= 3.2.1.0)
|
61
|
+
rubocop-minitest (0.31.0)
|
62
|
+
rubocop (>= 1.39, < 2.0)
|
65
63
|
rubocop-rake (0.6.0)
|
66
64
|
rubocop (~> 1.0)
|
67
|
-
rubocop-sorbet (0.
|
65
|
+
rubocop-sorbet (0.7.0)
|
68
66
|
rubocop (>= 0.90.0)
|
69
|
-
ruby-
|
70
|
-
|
71
|
-
sorbet-
|
72
|
-
|
73
|
-
|
74
|
-
sorbet (0.5.
|
75
|
-
|
76
|
-
sorbet-runtime (0.5.
|
77
|
-
|
78
|
-
|
79
|
-
sorbet-static (0.5.10626-x86_64-linux)
|
80
|
-
sorbet-static-and-runtime (0.5.10626)
|
81
|
-
sorbet (= 0.5.10626)
|
82
|
-
sorbet-runtime (= 0.5.10626)
|
67
|
+
ruby-progressbar (1.13.0)
|
68
|
+
sorbet (0.5.10827)
|
69
|
+
sorbet-static (= 0.5.10827)
|
70
|
+
sorbet-runtime (0.5.10827)
|
71
|
+
sorbet-static (0.5.10827-universal-darwin-21)
|
72
|
+
sorbet-static (0.5.10827-universal-darwin-22)
|
73
|
+
sorbet-static (0.5.10827-x86_64-linux)
|
74
|
+
sorbet-static-and-runtime (0.5.10827)
|
75
|
+
sorbet (= 0.5.10827)
|
76
|
+
sorbet-runtime (= 0.5.10827)
|
83
77
|
sorbet-struct-comparable (1.3.0)
|
84
78
|
sorbet-runtime (>= 0.5)
|
85
|
-
spoom (1.1
|
79
|
+
spoom (1.2.1)
|
86
80
|
sorbet (>= 0.5.10187)
|
87
81
|
sorbet-runtime (>= 0.5.9204)
|
88
82
|
thor (>= 0.19.2)
|
89
|
-
sqlite3 (1.6.
|
90
|
-
sqlite3 (1.6.
|
91
|
-
|
92
|
-
|
93
|
-
tapioca (0.10.5)
|
94
|
-
bundler (>= 1.17.3)
|
83
|
+
sqlite3 (1.6.2-arm64-darwin)
|
84
|
+
sqlite3 (1.6.2-x86_64-linux)
|
85
|
+
tapioca (0.11.6)
|
86
|
+
bundler (>= 2.2.25)
|
95
87
|
netrc (>= 0.11.0)
|
96
88
|
parallel (>= 1.21.0)
|
97
89
|
rbi (~> 0.0.0, >= 0.0.16)
|
98
90
|
sorbet-static-and-runtime (>= 0.5.10187)
|
99
|
-
spoom (~> 1.
|
91
|
+
spoom (~> 1.2.0, >= 1.2.0)
|
100
92
|
thor (>= 1.2.0)
|
101
93
|
yard-sorbet
|
102
|
-
thor (1.2.
|
103
|
-
tzinfo (2.0.
|
94
|
+
thor (1.2.2)
|
95
|
+
tzinfo (2.0.6)
|
104
96
|
concurrent-ruby (~> 1.0)
|
105
97
|
unicode-display_width (2.4.2)
|
106
98
|
unparser (0.6.7)
|
107
99
|
diff-lcs (~> 1.3)
|
108
100
|
parser (>= 3.2.0)
|
109
|
-
|
110
|
-
yard (0.
|
111
|
-
webrick (~> 1.7.0)
|
112
|
-
yard-sorbet (0.8.0)
|
101
|
+
yard (0.9.34)
|
102
|
+
yard-sorbet (0.8.1)
|
113
103
|
sorbet-runtime (>= 0.5)
|
114
104
|
yard (>= 0.9)
|
115
105
|
|
@@ -127,7 +117,6 @@ DEPENDENCIES
|
|
127
117
|
rubocop-minitest
|
128
118
|
rubocop-rake
|
129
119
|
rubocop-sorbet
|
130
|
-
ruby-lsp
|
131
120
|
sorbet
|
132
121
|
sorbet-runtime
|
133
122
|
sorbet-struct-comparable
|
@@ -136,4 +125,4 @@ DEPENDENCIES
|
|
136
125
|
tapioca
|
137
126
|
|
138
127
|
BUNDLED WITH
|
139
|
-
2.4.
|
128
|
+
2.4.10
|
data/README.md
CHANGED
@@ -20,7 +20,7 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
Let's say you have an `ActiveRecord` model for a `User` with a string `name` column, an integer `age` column
|
23
|
+
Let's say you have an `ActiveRecord` model for a `User` with a string `name` column, an integer `age` column, a `role` enum column and a belongs to association with a `Location` model. Another way to express this would be a `User` type that is a simple, typed struct with other supporting structs.
|
24
24
|
|
25
25
|
```ruby
|
26
26
|
module Types
|
@@ -31,10 +31,15 @@ module Types
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
class Location < T::Struct
|
35
|
+
const :name, String
|
36
|
+
end
|
37
|
+
|
34
38
|
class User < T::Struct
|
35
39
|
const :name, String
|
36
40
|
const :age, Integer
|
37
41
|
const :role, UserRoles
|
42
|
+
const :location, Location
|
38
43
|
end
|
39
44
|
end
|
40
45
|
```
|
@@ -43,6 +48,7 @@ In our model, we can specify an ejection to this type.
|
|
43
48
|
|
44
49
|
```ruby
|
45
50
|
class User
|
51
|
+
belongs_to :location
|
46
52
|
enum :role, { admin: "admin", member: "member" }
|
47
53
|
|
48
54
|
ejects_to Types::User
|
@@ -52,17 +58,18 @@ end
|
|
52
58
|
Now, we have two new methods available on `User`. First, we can eject from a `User` instance to a `Types::User`.
|
53
59
|
|
54
60
|
```ruby
|
55
|
-
|
56
|
-
|
57
|
-
User
|
61
|
+
location = Location.new(name: "Florida")
|
62
|
+
User.new(name: "Max", age: 28, role: "admin", location: location).eject
|
63
|
+
# => Types::User(name: "Max", age: 28, role: Types::UserRoles::Admin, location: Types::Location.new(name: "Florida))
|
64
|
+
User.new(name: "Max", age: 28, role: "admin", location: location).to_struct # alias
|
58
65
|
```
|
59
66
|
|
60
67
|
Second, we can buckle into the `User` model with a `Types::User`.
|
61
68
|
|
62
69
|
```ruby
|
63
|
-
user_struct = Types::User.new(name: "Max", age: 28, role: Types::UserRoles::Admin)
|
70
|
+
user_struct = Types::User.new(name: "Max", age: 28, role: Types::UserRoles::Admin, location: Types::Location.new(name: "Florida"))
|
64
71
|
User.buckle(user_struct)
|
65
|
-
# => User(name: "Max", age: 28, role: "admin")
|
72
|
+
# => User(name: "Max", age: 28, role: "admin", location: Location(name: "Florida"))
|
66
73
|
User.from_struct(user_struct) # alias
|
67
74
|
```
|
68
75
|
|
@@ -74,7 +81,7 @@ To install this gem onto your local machine, run `bundle exec rake install`.
|
|
74
81
|
|
75
82
|
## Contributing
|
76
83
|
|
77
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
84
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/maxveldink/activerecord-ejection_seat. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/maxveldink/activerecord-ejection_seat/blob/master/CODE_OF_CONDUCT.md).
|
78
85
|
|
79
86
|
## License
|
80
87
|
|
@@ -82,4 +89,8 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
82
89
|
|
83
90
|
## Code of Conduct
|
84
91
|
|
85
|
-
Everyone interacting in this project's codebase, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
92
|
+
Everyone interacting in this project's codebase, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/maxveldink/activerecord-ejection_seat/blob/master/CODE_OF_CONDUCT.md).
|
93
|
+
|
94
|
+
## Sponsorships
|
95
|
+
|
96
|
+
I love creating in the open. If you find this or any other [maxveld.ink](https://maxveld.ink) content useful, please consider sponsoring me on [GitHub](https://github.com/sponsors/maxveldink).
|