rbs_draper 0.1.1 → 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/Gemfile.lock +1 -1
- data/lib/rbs_draper/decoratable.rb +18 -10
- data/lib/rbs_draper/version.rb +1 -1
- data/sig/rbs_draper/decoratable.rbs +1 -0
- metadata +1 -1
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/Gemfile.lock
CHANGED
@@ -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/version.rb
CHANGED