rbs_active_hash 1.0.0 → 1.0.1
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 +7 -6
- data/lib/rbs_active_hash/active_hash.rb +20 -8
- data/lib/rbs_active_hash/version.rb +1 -1
- data/sig/rbs_active_hash/active_hash.rbs +2 -3
- 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: 57044cf3bbe008c0523f22f062fb7936a43ddce6a03e17f04e02daef661c092d
|
4
|
+
data.tar.gz: b6533e6014fcef654e87d2187e381dced145f2f4828567e0e226b241d7258233
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba76fab12f70ac6cb4bae32d6861657f4932f5e7509a2b33e273d6bd7ed954eab626af709fcc91780c6f68caad7de36c05796f4aa2cb17befd7708200a99ef79
|
7
|
+
data.tar.gz: ac00937fc78c4fd2e098ab1154aedf79a1626ab48e810ee543143087a4d83424b5547708c7b9edf7fcf5431f5d9e8e2eea54a17562e01a961fab0e1a5196908e
|
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_active_hash (1.0.
|
4
|
+
rbs_active_hash (1.0.1)
|
5
5
|
active_hash
|
6
6
|
rbs_rails
|
7
7
|
|
@@ -61,8 +61,9 @@ GEM
|
|
61
61
|
nokogiri (1.15.2-x86_64-linux)
|
62
62
|
racc (~> 1.4)
|
63
63
|
parallel (1.23.0)
|
64
|
-
parser (3.2.2.
|
64
|
+
parser (3.2.2.3)
|
65
65
|
ast (~> 2.4.1)
|
66
|
+
racc
|
66
67
|
pry (0.14.2)
|
67
68
|
coderay (~> 1.1)
|
68
69
|
method_source (~> 1.0)
|
@@ -92,7 +93,7 @@ GEM
|
|
92
93
|
rbs_rails (0.12.0)
|
93
94
|
parser
|
94
95
|
rbs (>= 1)
|
95
|
-
regexp_parser (2.8.
|
96
|
+
regexp_parser (2.8.1)
|
96
97
|
rexml (3.2.5)
|
97
98
|
rspec (3.12.0)
|
98
99
|
rspec-core (~> 3.12.0)
|
@@ -110,10 +111,10 @@ GEM
|
|
110
111
|
diff-lcs (>= 1.2.0, < 2.0)
|
111
112
|
rspec-support (~> 3.12.0)
|
112
113
|
rspec-support (3.12.0)
|
113
|
-
rubocop (1.52.
|
114
|
+
rubocop (1.52.1)
|
114
115
|
json (~> 2.3)
|
115
116
|
parallel (~> 1.10)
|
116
|
-
parser (>= 3.2.
|
117
|
+
parser (>= 3.2.2.3)
|
117
118
|
rainbow (>= 2.2.2, < 4.0)
|
118
119
|
regexp_parser (>= 1.8, < 3.0)
|
119
120
|
rexml (>= 3.2.5, < 4.0)
|
@@ -159,7 +160,7 @@ DEPENDENCIES
|
|
159
160
|
rbs_active_hash!
|
160
161
|
rspec
|
161
162
|
rspec-daemon
|
162
|
-
rubocop (~> 1.
|
163
|
+
rubocop (~> 1.52)
|
163
164
|
steep
|
164
165
|
|
165
166
|
BUNDLED WITH
|
@@ -15,8 +15,11 @@ module RbsActiveHash
|
|
15
15
|
end
|
16
16
|
|
17
17
|
class Generator
|
18
|
+
attr_reader :klass, :klass_name
|
19
|
+
|
18
20
|
def initialize(klass)
|
19
21
|
@klass = klass
|
22
|
+
@klass_name = RbsRails::Util.module_name(klass)
|
20
23
|
end
|
21
24
|
|
22
25
|
def generate
|
@@ -43,12 +46,23 @@ module RbsActiveHash
|
|
43
46
|
end
|
44
47
|
|
45
48
|
def header
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
namespace = +""
|
50
|
+
klass_name.split("::").map do |mod_name|
|
51
|
+
namespace += "::#{mod_name}"
|
52
|
+
mod_object = Object.const_get(namespace)
|
53
|
+
case mod_object
|
54
|
+
when Class
|
55
|
+
# @type var superclass: Class
|
56
|
+
superclass = _ = mod_object.superclass
|
57
|
+
superclass_name = RbsRails::Util.module_name(superclass)
|
58
|
+
|
59
|
+
"class #{mod_name} < ::#{superclass_name}"
|
60
|
+
when Module
|
61
|
+
"module #{mod_name}"
|
62
|
+
else
|
63
|
+
raise "unreachable"
|
64
|
+
end
|
65
|
+
end.join("\n")
|
52
66
|
end
|
53
67
|
|
54
68
|
def module_names
|
@@ -139,8 +153,6 @@ module RbsActiveHash
|
|
139
153
|
type.to_s
|
140
154
|
end
|
141
155
|
end
|
142
|
-
|
143
|
-
attr_reader :klass
|
144
156
|
end
|
145
157
|
end
|
146
158
|
end
|
@@ -4,7 +4,8 @@ module RbsActiveHash
|
|
4
4
|
def self.class_to_rbs: (Class klass) -> String
|
5
5
|
|
6
6
|
class Generator
|
7
|
-
|
7
|
+
attr_reader klass: Class
|
8
|
+
attr_reader klass_name: String
|
8
9
|
|
9
10
|
def initialize: (Class class) -> void
|
10
11
|
def generate: () -> String
|
@@ -22,8 +23,6 @@ module RbsActiveHash
|
|
22
23
|
def footer: () -> String
|
23
24
|
|
24
25
|
def stringify_type: (untyped type) -> String
|
25
|
-
|
26
|
-
attr_reader klass: Class
|
27
26
|
end
|
28
27
|
end
|
29
28
|
end
|
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.0.
|
4
|
+
version: 1.0.1
|
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: active_hash
|