rbs_active_hash 1.3.0 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +16 -20
- data/lib/generators/rbs_active_hash/install_generator.rb +3 -1
- data/lib/rbs_active_hash/active_hash.rb +13 -7
- data/lib/rbs_active_hash/version.rb +1 -1
- data/rbs_active_hash.gemspec +0 -1
- data/rbs_collection.lock.yaml +28 -20
- data/sig/rbs_active_hash/active_hash/parser.rbs +1 -1
- data/sig/rbs_active_hash/active_hash.rbs +2 -1
- data/sig/rbs_active_hash/rake_task.rbs +1 -1
- metadata +2 -17
- data/sig/shims/thor.rbs +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69a9fa4f66ca52f64cf235295003834705238e5f9dd1ee5e2697e0b1800087c5
|
4
|
+
data.tar.gz: f950fd44124f574d4395f02ce89ea63e3197c61f45d09bbb2ae19b7a9d492e32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4a1e155c10141878daad145dd54e2a202fee7c34d378fa7ed81b2507d0de14665e6708372deb709561b9bddf799d1fecc6a781b33345814ae1cd2689cc890b3
|
7
|
+
data.tar.gz: 237d4d4c561cefb313abc6e2a8090fe188070f0c30ce05961f70d01cd956654dcd853d1649b529660bc588941155373a1389850fc2f2e149f4287de19ca18404
|
data/Gemfile.lock
CHANGED
@@ -1,35 +1,34 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rbs_active_hash (1.3.
|
4
|
+
rbs_active_hash (1.3.2)
|
5
5
|
active_hash
|
6
6
|
rbs
|
7
|
-
rbs_rails
|
8
7
|
|
9
8
|
GEM
|
10
9
|
remote: https://rubygems.org/
|
11
10
|
specs:
|
12
|
-
actionpack (7.0.7)
|
13
|
-
actionview (= 7.0.7)
|
14
|
-
activesupport (= 7.0.7)
|
11
|
+
actionpack (7.0.7.2)
|
12
|
+
actionview (= 7.0.7.2)
|
13
|
+
activesupport (= 7.0.7.2)
|
15
14
|
rack (~> 2.0, >= 2.2.4)
|
16
15
|
rack-test (>= 0.6.3)
|
17
16
|
rails-dom-testing (~> 2.0)
|
18
17
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
19
|
-
actionview (7.0.7)
|
20
|
-
activesupport (= 7.0.7)
|
18
|
+
actionview (7.0.7.2)
|
19
|
+
activesupport (= 7.0.7.2)
|
21
20
|
builder (~> 3.1)
|
22
21
|
erubi (~> 1.4)
|
23
22
|
rails-dom-testing (~> 2.0)
|
24
23
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
25
24
|
active_hash (3.2.0)
|
26
25
|
activesupport (>= 5.0.0)
|
27
|
-
activemodel (7.0.7)
|
28
|
-
activesupport (= 7.0.7)
|
29
|
-
activerecord (7.0.7)
|
30
|
-
activemodel (= 7.0.7)
|
31
|
-
activesupport (= 7.0.7)
|
32
|
-
activesupport (7.0.7)
|
26
|
+
activemodel (7.0.7.2)
|
27
|
+
activesupport (= 7.0.7.2)
|
28
|
+
activerecord (7.0.7.2)
|
29
|
+
activemodel (= 7.0.7.2)
|
30
|
+
activesupport (= 7.0.7.2)
|
31
|
+
activesupport (7.0.7.2)
|
33
32
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
34
33
|
i18n (>= 1.6, < 2)
|
35
34
|
minitest (>= 5.1)
|
@@ -80,9 +79,9 @@ GEM
|
|
80
79
|
rails-html-sanitizer (1.6.0)
|
81
80
|
loofah (~> 2.21)
|
82
81
|
nokogiri (~> 1.14)
|
83
|
-
railties (7.0.7)
|
84
|
-
actionpack (= 7.0.7)
|
85
|
-
activesupport (= 7.0.7)
|
82
|
+
railties (7.0.7.2)
|
83
|
+
actionpack (= 7.0.7.2)
|
84
|
+
activesupport (= 7.0.7.2)
|
86
85
|
method_source
|
87
86
|
rake (>= 12.2)
|
88
87
|
thor (~> 1.0)
|
@@ -93,9 +92,6 @@ GEM
|
|
93
92
|
rb-inotify (0.10.1)
|
94
93
|
ffi (~> 1.0)
|
95
94
|
rbs (3.1.3)
|
96
|
-
rbs_rails (0.12.0)
|
97
|
-
parser
|
98
|
-
rbs (>= 1)
|
99
95
|
regexp_parser (2.8.1)
|
100
96
|
rexml (3.2.6)
|
101
97
|
rspec (3.12.0)
|
@@ -114,7 +110,7 @@ GEM
|
|
114
110
|
diff-lcs (>= 1.2.0, < 2.0)
|
115
111
|
rspec-support (~> 3.12.0)
|
116
112
|
rspec-support (3.12.0)
|
117
|
-
rubocop (1.56.
|
113
|
+
rubocop (1.56.3)
|
118
114
|
base64 (~> 0.1.1)
|
119
115
|
json (~> 2.3)
|
120
116
|
language_server-protocol (>= 3.17.0)
|
@@ -6,8 +6,10 @@ module RbsActiveHash
|
|
6
6
|
class InstallGenerator < Rails::Generators::Base
|
7
7
|
def create_raketask
|
8
8
|
create_file "lib/tasks/rbs_active_hash.rake", <<~RUBY
|
9
|
+
# frozen_string_literal: true
|
10
|
+
|
9
11
|
begin
|
10
|
-
require
|
12
|
+
require "rbs_active_hash/rake_task"
|
11
13
|
|
12
14
|
RbsActiveHash::RakeTask.new
|
13
15
|
rescue LoadError
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "rbs"
|
4
|
-
require "rbs_rails/util"
|
5
4
|
require "active_hash"
|
6
5
|
|
7
6
|
module RbsActiveHash
|
@@ -19,7 +18,7 @@ module RbsActiveHash
|
|
19
18
|
|
20
19
|
def initialize(klass)
|
21
20
|
@klass = klass
|
22
|
-
@klass_name =
|
21
|
+
@klass_name = klass.name || ""
|
23
22
|
@parser = ActiveHash::Parser::Parser.new
|
24
23
|
|
25
24
|
path, = Object.const_source_location(klass_name)
|
@@ -29,7 +28,7 @@ module RbsActiveHash
|
|
29
28
|
end
|
30
29
|
|
31
30
|
def generate
|
32
|
-
if klass
|
31
|
+
if klass < ::ActiveFile::Base
|
33
32
|
begin
|
34
33
|
klass.reload
|
35
34
|
rescue StandardError
|
@@ -37,11 +36,18 @@ module RbsActiveHash
|
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
40
|
-
|
39
|
+
format(klass_decl)
|
41
40
|
end
|
42
41
|
|
43
42
|
private
|
44
43
|
|
44
|
+
def format(rbs)
|
45
|
+
parsed = RBS::Parser.parse_signature(rbs)
|
46
|
+
StringIO.new.tap do |out|
|
47
|
+
RBS::Writer.new(out: out).write(parsed[1] + parsed[2])
|
48
|
+
end.string
|
49
|
+
end
|
50
|
+
|
45
51
|
def klass_decl
|
46
52
|
<<~RBS
|
47
53
|
#{header}
|
@@ -62,7 +68,7 @@ module RbsActiveHash
|
|
62
68
|
when Class
|
63
69
|
# @type var superclass: Class
|
64
70
|
superclass = _ = mod_object.superclass
|
65
|
-
superclass_name =
|
71
|
+
superclass_name = superclass.name || "Object"
|
66
72
|
|
67
73
|
"class #{mod_name} < ::#{superclass_name}"
|
68
74
|
when Module
|
@@ -174,8 +180,8 @@ module RbsActiveHash
|
|
174
180
|
def #{method}: () -> #{method_type}
|
175
181
|
def #{method}=: (#{method_type} value) -> #{method_type}
|
176
182
|
def #{method}?: () -> bool
|
177
|
-
def self.find_by_#{method}: (#{method_type} value) ->
|
178
|
-
def self.find_all_by_#{method}: (#{method_type} value) -> Array[
|
183
|
+
def self.find_by_#{method}: (#{method_type} value) -> instance?
|
184
|
+
def self.find_all_by_#{method}: (#{method_type} value) -> Array[instance]
|
179
185
|
RBS
|
180
186
|
end.join("\n")
|
181
187
|
end
|
data/rbs_active_hash.gemspec
CHANGED
@@ -29,7 +29,6 @@ Gem::Specification.new do |spec|
|
|
29
29
|
|
30
30
|
spec.add_dependency "active_hash"
|
31
31
|
spec.add_dependency "rbs"
|
32
|
-
spec.add_dependency "rbs_rails"
|
33
32
|
|
34
33
|
# For more information and examples about making a new gem, check out our
|
35
34
|
# guide at: https://bundler.io/guides/creating_gem.html
|
data/rbs_collection.lock.yaml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
sources:
|
3
3
|
- type: git
|
4
4
|
name: ruby/gem_rbs_collection
|
5
|
-
revision:
|
5
|
+
revision: c560bb18418e07a709f80954db2e2d975bbd6e14
|
6
6
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
7
7
|
repo_dir: gems
|
8
8
|
path: ".gem_rbs_collection"
|
@@ -16,7 +16,7 @@ gems:
|
|
16
16
|
source:
|
17
17
|
type: git
|
18
18
|
name: ruby/gem_rbs_collection
|
19
|
-
revision:
|
19
|
+
revision: c560bb18418e07a709f80954db2e2d975bbd6e14
|
20
20
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
21
21
|
repo_dir: gems
|
22
22
|
- name: actionview
|
@@ -24,7 +24,7 @@ gems:
|
|
24
24
|
source:
|
25
25
|
type: git
|
26
26
|
name: ruby/gem_rbs_collection
|
27
|
-
revision:
|
27
|
+
revision: c560bb18418e07a709f80954db2e2d975bbd6e14
|
28
28
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
29
29
|
repo_dir: gems
|
30
30
|
- name: active_hash
|
@@ -32,7 +32,7 @@ gems:
|
|
32
32
|
source:
|
33
33
|
type: git
|
34
34
|
name: ruby/gem_rbs_collection
|
35
|
-
revision:
|
35
|
+
revision: c560bb18418e07a709f80954db2e2d975bbd6e14
|
36
36
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
37
37
|
repo_dir: gems
|
38
38
|
- name: activemodel
|
@@ -40,7 +40,7 @@ gems:
|
|
40
40
|
source:
|
41
41
|
type: git
|
42
42
|
name: ruby/gem_rbs_collection
|
43
|
-
revision:
|
43
|
+
revision: c560bb18418e07a709f80954db2e2d975bbd6e14
|
44
44
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
45
45
|
repo_dir: gems
|
46
46
|
- name: activerecord
|
@@ -48,7 +48,7 @@ gems:
|
|
48
48
|
source:
|
49
49
|
type: git
|
50
50
|
name: ruby/gem_rbs_collection
|
51
|
-
revision:
|
51
|
+
revision: c560bb18418e07a709f80954db2e2d975bbd6e14
|
52
52
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
53
53
|
repo_dir: gems
|
54
54
|
- name: activesupport
|
@@ -56,7 +56,7 @@ gems:
|
|
56
56
|
source:
|
57
57
|
type: git
|
58
58
|
name: ruby/gem_rbs_collection
|
59
|
-
revision:
|
59
|
+
revision: c560bb18418e07a709f80954db2e2d975bbd6e14
|
60
60
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
61
61
|
repo_dir: gems
|
62
62
|
- name: ast
|
@@ -64,7 +64,7 @@ gems:
|
|
64
64
|
source:
|
65
65
|
type: git
|
66
66
|
name: ruby/gem_rbs_collection
|
67
|
-
revision:
|
67
|
+
revision: c560bb18418e07a709f80954db2e2d975bbd6e14
|
68
68
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
69
69
|
repo_dir: gems
|
70
70
|
- name: base64
|
@@ -80,19 +80,23 @@ gems:
|
|
80
80
|
source:
|
81
81
|
type: git
|
82
82
|
name: ruby/gem_rbs_collection
|
83
|
-
revision:
|
83
|
+
revision: c560bb18418e07a709f80954db2e2d975bbd6e14
|
84
84
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
85
85
|
repo_dir: gems
|
86
86
|
- name: date
|
87
87
|
version: '0'
|
88
88
|
source:
|
89
89
|
type: stdlib
|
90
|
+
- name: erb
|
91
|
+
version: '0'
|
92
|
+
source:
|
93
|
+
type: stdlib
|
90
94
|
- name: i18n
|
91
95
|
version: '1.10'
|
92
96
|
source:
|
93
97
|
type: git
|
94
98
|
name: ruby/gem_rbs_collection
|
95
|
-
revision:
|
99
|
+
revision: c560bb18418e07a709f80954db2e2d975bbd6e14
|
96
100
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
97
101
|
repo_dir: gems
|
98
102
|
- name: json
|
@@ -120,7 +124,7 @@ gems:
|
|
120
124
|
source:
|
121
125
|
type: git
|
122
126
|
name: ruby/gem_rbs_collection
|
123
|
-
revision:
|
127
|
+
revision: c560bb18418e07a709f80954db2e2d975bbd6e14
|
124
128
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
125
129
|
repo_dir: gems
|
126
130
|
- name: optparse
|
@@ -132,7 +136,7 @@ gems:
|
|
132
136
|
source:
|
133
137
|
type: git
|
134
138
|
name: ruby/gem_rbs_collection
|
135
|
-
revision:
|
139
|
+
revision: c560bb18418e07a709f80954db2e2d975bbd6e14
|
136
140
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
137
141
|
repo_dir: gems
|
138
142
|
- name: pathname
|
@@ -144,7 +148,7 @@ gems:
|
|
144
148
|
source:
|
145
149
|
type: git
|
146
150
|
name: ruby/gem_rbs_collection
|
147
|
-
revision:
|
151
|
+
revision: c560bb18418e07a709f80954db2e2d975bbd6e14
|
148
152
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
149
153
|
repo_dir: gems
|
150
154
|
- name: rails-dom-testing
|
@@ -152,7 +156,7 @@ gems:
|
|
152
156
|
source:
|
153
157
|
type: git
|
154
158
|
name: ruby/gem_rbs_collection
|
155
|
-
revision:
|
159
|
+
revision: c560bb18418e07a709f80954db2e2d975bbd6e14
|
156
160
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
157
161
|
repo_dir: gems
|
158
162
|
- name: railties
|
@@ -160,7 +164,7 @@ gems:
|
|
160
164
|
source:
|
161
165
|
type: git
|
162
166
|
name: ruby/gem_rbs_collection
|
163
|
-
revision:
|
167
|
+
revision: c560bb18418e07a709f80954db2e2d975bbd6e14
|
164
168
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
165
169
|
repo_dir: gems
|
166
170
|
- name: rainbow
|
@@ -168,17 +172,13 @@ gems:
|
|
168
172
|
source:
|
169
173
|
type: git
|
170
174
|
name: ruby/gem_rbs_collection
|
171
|
-
revision:
|
175
|
+
revision: c560bb18418e07a709f80954db2e2d975bbd6e14
|
172
176
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
173
177
|
repo_dir: gems
|
174
178
|
- name: rbs
|
175
179
|
version: 3.1.3
|
176
180
|
source:
|
177
181
|
type: rubygems
|
178
|
-
- name: rbs_rails
|
179
|
-
version: 0.12.0
|
180
|
-
source:
|
181
|
-
type: rubygems
|
182
182
|
- name: rdoc
|
183
183
|
version: '0'
|
184
184
|
source:
|
@@ -195,6 +195,14 @@ gems:
|
|
195
195
|
version: '0'
|
196
196
|
source:
|
197
197
|
type: stdlib
|
198
|
+
- name: thor
|
199
|
+
version: '1.2'
|
200
|
+
source:
|
201
|
+
type: git
|
202
|
+
name: ruby/gem_rbs_collection
|
203
|
+
revision: c560bb18418e07a709f80954db2e2d975bbd6e14
|
204
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
205
|
+
repo_dir: gems
|
198
206
|
- name: time
|
199
207
|
version: '0'
|
200
208
|
source:
|
@@ -20,7 +20,7 @@ module RbsActiveHash
|
|
20
20
|
def parse: (String string, Array[Symbol] target) -> void
|
21
21
|
def process: (RBS::AST::Declarations::t | RBS::AST::Members::t node, Array[Symbol] target) -> void
|
22
22
|
def process_association_definition: (AssociationDefinition node) -> void
|
23
|
-
def process_scope_definition: (
|
23
|
+
def process_scope_definition: (ScopeDefinition node) -> void
|
24
24
|
def node_to_literal: (untyped node) -> untyped
|
25
25
|
end
|
26
26
|
end
|
@@ -13,6 +13,7 @@ module RbsActiveHash
|
|
13
13
|
|
14
14
|
private
|
15
15
|
|
16
|
+
def format: (String) -> String
|
16
17
|
def klass_decl: () -> String
|
17
18
|
def header: () -> String
|
18
19
|
def enum_decls: () -> String?
|
@@ -25,7 +26,7 @@ module RbsActiveHash
|
|
25
26
|
def method_decls: () -> String
|
26
27
|
def method_names: () -> Array[Symbol]
|
27
28
|
def method_types: () -> Hash[Symbol, untyped]
|
28
|
-
def valid_field_name?: (String) -> boolish
|
29
|
+
def valid_field_name?: (String | Symbol) -> boolish
|
29
30
|
def footer: () -> String
|
30
31
|
|
31
32
|
def identify_class: (untyped value) -> (String | singleton(Class))
|
@@ -6,7 +6,7 @@ module RbsActiveHash
|
|
6
6
|
@name: Symbol
|
7
7
|
@signature_root_dir: Pathname
|
8
8
|
|
9
|
-
def initialize: (Symbol name) { (RakeTask) -> void } -> void
|
9
|
+
def initialize: (?Symbol name) { (RakeTask) -> void } -> void
|
10
10
|
def define_setup_task: () -> void
|
11
11
|
def define_clean_task: () -> void
|
12
12
|
def define_generate_task: () -> void
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbs_active_hash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takeshi KOMIYA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_hash
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rbs_rails
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
description: A RBS files generator for ActiveHash models
|
56
42
|
email:
|
57
43
|
- i.tkomiya@gmail.com
|
@@ -84,7 +70,6 @@ files:
|
|
84
70
|
- sig/rbs_active_hash/active_hash/parser.rbs
|
85
71
|
- sig/rbs_active_hash/rake_task.rbs
|
86
72
|
- sig/shims/rake.rbs
|
87
|
-
- sig/shims/thor.rbs
|
88
73
|
homepage: https://github.com/tk0miya/rbs_active_hash
|
89
74
|
licenses:
|
90
75
|
- MIT
|