rbs_draper 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/.vscode/extensions.json +2 -1
- data/.vscode/settings.json +2 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +5 -5
- data/lib/rbs_draper/decoratable.rb +18 -10
- data/lib/rbs_draper/decorator.rb +19 -11
- data/lib/rbs_draper/version.rb +1 -1
- data/sig/rbs_draper/decoratable.rbs +1 -0
- data/sig/rbs_draper/decorator.rbs +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d2bfcf84e0f5af5a65871e40710100241df8232a871e7794f3f52be4637f41a
|
4
|
+
data.tar.gz: 3402cdab07e8e6b782c8230108232dfc60f3ab3b719ba3f160b9158c32237f49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 236ba1a705da99b87bbeb5bf3eab2df035cf1701a390fb3b70db428529e052613b75123ccde23f06b1c40056443cc7043defa06c58ff32621aba59d7e54b3aab
|
7
|
+
data.tar.gz: 5ed785300e261837ab808217eeca0a0a438cbd3d07b2bd8c3dc70632b56ff53e7f0db552745e76d5f93e88e907e4e3fddbc20fc22f393d56ad00403118f6751b
|
data/.rubocop.yml
CHANGED
data/.vscode/extensions.json
CHANGED
data/.vscode/settings.json
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rbs_draper (0.1.
|
4
|
+
rbs_draper (0.1.2)
|
5
5
|
draper
|
6
6
|
rbs_rails
|
7
7
|
|
@@ -76,7 +76,7 @@ GEM
|
|
76
76
|
pry (0.14.2)
|
77
77
|
coderay (~> 1.1)
|
78
78
|
method_source (~> 1.0)
|
79
|
-
racc (1.7.
|
79
|
+
racc (1.7.1)
|
80
80
|
rack (2.2.7)
|
81
81
|
rack-test (2.1.0)
|
82
82
|
rack (>= 1.3)
|
@@ -122,10 +122,10 @@ GEM
|
|
122
122
|
diff-lcs (>= 1.2.0, < 2.0)
|
123
123
|
rspec-support (~> 3.12.0)
|
124
124
|
rspec-support (3.12.0)
|
125
|
-
rubocop (1.52.
|
125
|
+
rubocop (1.52.1)
|
126
126
|
json (~> 2.3)
|
127
127
|
parallel (~> 1.10)
|
128
|
-
parser (>= 3.2.
|
128
|
+
parser (>= 3.2.2.3)
|
129
129
|
rainbow (>= 2.2.2, < 4.0)
|
130
130
|
regexp_parser (>= 1.8, < 3.0)
|
131
131
|
rexml (>= 3.2.5, < 4.0)
|
@@ -172,7 +172,7 @@ DEPENDENCIES
|
|
172
172
|
rbs_draper!
|
173
173
|
rspec
|
174
174
|
rspec-daemon
|
175
|
-
rubocop (~> 1.
|
175
|
+
rubocop (~> 1.52)
|
176
176
|
steep
|
177
177
|
|
178
178
|
BUNDLED WITH
|
@@ -18,10 +18,11 @@ module RbsDraper
|
|
18
18
|
end
|
19
19
|
|
20
20
|
class Generator
|
21
|
-
attr_reader :klass
|
21
|
+
attr_reader :klass, :klass_name
|
22
22
|
|
23
23
|
def initialize(klass)
|
24
24
|
@klass = klass
|
25
|
+
@klass_name = RbsRails::Util.module_name(klass)
|
25
26
|
end
|
26
27
|
|
27
28
|
def generate
|
@@ -39,16 +40,23 @@ module RbsDraper
|
|
39
40
|
end
|
40
41
|
|
41
42
|
def header
|
42
|
-
|
43
|
+
namespace = +""
|
44
|
+
klass_name.split("::").map do |mod_name|
|
45
|
+
namespace += "::#{mod_name}"
|
46
|
+
mod_object = Object.const_get(namespace)
|
47
|
+
case mod_object
|
48
|
+
when Class
|
49
|
+
# @type var superclass: Class
|
50
|
+
superclass = _ = mod_object.superclass
|
51
|
+
superclass_name = RbsRails::Util.module_name(superclass)
|
43
52
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
(module_defs + [class_def]).join("\n")
|
53
|
+
"class #{mod_name} < ::#{superclass_name}"
|
54
|
+
when Module
|
55
|
+
"module #{mod_name}"
|
56
|
+
else
|
57
|
+
raise "unreachable"
|
58
|
+
end
|
59
|
+
end.join("\n")
|
52
60
|
end
|
53
61
|
|
54
62
|
def method_decls
|
data/lib/rbs_draper/decorator.rb
CHANGED
@@ -11,10 +11,11 @@ module RbsDraper
|
|
11
11
|
end
|
12
12
|
|
13
13
|
class Generator
|
14
|
-
attr_reader :klass, :rbs_builder
|
14
|
+
attr_reader :klass, :klass_name, :rbs_builder
|
15
15
|
|
16
16
|
def initialize(klass, rbs_builder)
|
17
17
|
@klass = klass
|
18
|
+
@klass_name = RbsRails::Util.module_name(klass)
|
18
19
|
@rbs_builder = rbs_builder
|
19
20
|
end
|
20
21
|
|
@@ -37,16 +38,23 @@ module RbsDraper
|
|
37
38
|
end
|
38
39
|
|
39
40
|
def header
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
41
|
+
namespace = +""
|
42
|
+
klass_name.split("::").map do |mod_name|
|
43
|
+
namespace += "::#{mod_name}"
|
44
|
+
mod_object = Object.const_get(namespace)
|
45
|
+
case mod_object
|
46
|
+
when Class
|
47
|
+
# @type var superclass: Class
|
48
|
+
superclass = _ = mod_object.superclass
|
49
|
+
superclass_name = RbsRails::Util.module_name(superclass)
|
50
|
+
|
51
|
+
"class #{mod_name} < ::#{superclass_name}"
|
52
|
+
when Module
|
53
|
+
"module #{mod_name}"
|
54
|
+
else
|
55
|
+
raise "unreachable"
|
56
|
+
end
|
57
|
+
end.join("\n")
|
50
58
|
end
|
51
59
|
|
52
60
|
def method_decls
|
data/lib/rbs_draper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbs_draper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.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-06-
|
11
|
+
date: 2023-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: draper
|