rbs_draper 1.1.1 → 1.1.3
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 -5
- data/lib/generators/rbs_draper/install_generator.rb +3 -1
- data/lib/rbs_draper/decoratable.rb +12 -10
- data/lib/rbs_draper/decorator.rb +12 -10
- data/lib/rbs_draper/sig/decorator.rbs +1 -0
- data/lib/rbs_draper/version.rb +1 -1
- data/rbs_collection.lock.yaml +20 -20
- data/rbs_draper.gemspec +0 -1
- data/sig/rbs_draper/decoratable.rbs +1 -1
- data/sig/rbs_draper/decorator.rbs +1 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf608d212ec0ad6d2d0f1ac28642e425b9f79afa6762973c302510b263c8fc7c
|
4
|
+
data.tar.gz: 615f1b9983be7510189c0d3580f67e9981fd594af4bc39d2ab444c3bcafe8c94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f70d4b49f6ff39a7bf429870e4b0a7d3dbfaf250d4c7e37742b6c2924d23533ff3c728989f220c8c80556c21eaa7e7f3952d0a3c4468ff34dd3f4411b1fbea5
|
7
|
+
data.tar.gz: 8a45bc1635b081590d3b00994285a07bdf18503d9fd02466e61a385edc11795a0c5b9f6c88acbf0c07995d4a8cd32253298e3a95ef1b6f533c85bdf6ab6218cd
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rbs_draper (1.1.
|
4
|
+
rbs_draper (1.1.3)
|
5
5
|
activesupport
|
6
6
|
draper
|
7
7
|
fileutils
|
8
8
|
rbs
|
9
|
-
rbs_rails
|
10
9
|
|
11
10
|
GEM
|
12
11
|
remote: https://rubygems.org/
|
@@ -104,9 +103,6 @@ GEM
|
|
104
103
|
rb-inotify (0.10.1)
|
105
104
|
ffi (~> 1.0)
|
106
105
|
rbs (3.1.3)
|
107
|
-
rbs_rails (0.12.0)
|
108
|
-
parser
|
109
|
-
rbs (>= 1)
|
110
106
|
regexp_parser (2.8.1)
|
111
107
|
request_store (1.5.1)
|
112
108
|
rack (>= 1.4)
|
@@ -7,7 +7,9 @@ module RbsDraper
|
|
7
7
|
def create_raketask
|
8
8
|
create_file "lib/tasks/rbs_draper.rake", <<~RUBY
|
9
9
|
begin
|
10
|
-
|
10
|
+
# frozen_string_literal: true
|
11
|
+
|
12
|
+
require "rbs_draper/rake_task"
|
11
13
|
|
12
14
|
RbsDraper::RakeTask.new do |task|
|
13
15
|
# If you have decorators having different names from models, you can specify the mapping from decorator names to model names.
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "draper"
|
4
|
-
require "rbs_rails"
|
5
4
|
|
6
5
|
module RbsDraper
|
7
6
|
module Decoratable
|
@@ -22,23 +21,26 @@ module RbsDraper
|
|
22
21
|
|
23
22
|
def initialize(klass)
|
24
23
|
@klass = klass
|
25
|
-
@klass_name =
|
24
|
+
@klass_name = klass.name || ""
|
26
25
|
end
|
27
26
|
|
28
27
|
def generate
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def klass_decl
|
35
|
-
<<~RBS
|
28
|
+
format <<~RBS
|
36
29
|
#{header}
|
37
30
|
#{method_decls}
|
38
31
|
#{footer}
|
39
32
|
RBS
|
40
33
|
end
|
41
34
|
|
35
|
+
private
|
36
|
+
|
37
|
+
def format(rbs)
|
38
|
+
parsed = RBS::Parser.parse_signature(rbs)
|
39
|
+
StringIO.new.tap do |out|
|
40
|
+
RBS::Writer.new(out: out).write(parsed[1] + parsed[2])
|
41
|
+
end.string
|
42
|
+
end
|
43
|
+
|
42
44
|
def header
|
43
45
|
namespace = +""
|
44
46
|
klass_name.split("::").map do |mod_name|
|
@@ -48,7 +50,7 @@ module RbsDraper
|
|
48
50
|
when Class
|
49
51
|
# @type var superclass: Class
|
50
52
|
superclass = _ = mod_object.superclass
|
51
|
-
superclass_name =
|
53
|
+
superclass_name = superclass.name || "Object"
|
52
54
|
|
53
55
|
"class #{mod_name} < ::#{superclass_name}"
|
54
56
|
when Module
|
data/lib/rbs_draper/decorator.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require "draper"
|
4
4
|
require "rbs"
|
5
|
-
require "rbs_rails"
|
6
5
|
|
7
6
|
module RbsDraper
|
8
7
|
module Decorator
|
@@ -15,7 +14,7 @@ module RbsDraper
|
|
15
14
|
|
16
15
|
def initialize(klass, rbs_builder, decorated_class: nil)
|
17
16
|
@klass = klass
|
18
|
-
@klass_name =
|
17
|
+
@klass_name = klass.name || ""
|
19
18
|
@rbs_builder = rbs_builder
|
20
19
|
@decorated_class = decorated_class
|
21
20
|
end
|
@@ -23,13 +22,7 @@ module RbsDraper
|
|
23
22
|
def generate
|
24
23
|
return if decorated_class_def.blank?
|
25
24
|
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
def klass_decl
|
32
|
-
<<~RBS
|
25
|
+
format <<~RBS
|
33
26
|
#{header}
|
34
27
|
#{object_method_decls}
|
35
28
|
|
@@ -38,6 +31,15 @@ module RbsDraper
|
|
38
31
|
RBS
|
39
32
|
end
|
40
33
|
|
34
|
+
private
|
35
|
+
|
36
|
+
def format(rbs)
|
37
|
+
parsed = RBS::Parser.parse_signature(rbs)
|
38
|
+
StringIO.new.tap do |out|
|
39
|
+
RBS::Writer.new(out: out).write(parsed[1] + parsed[2])
|
40
|
+
end.string
|
41
|
+
end
|
42
|
+
|
41
43
|
def header
|
42
44
|
namespace = +""
|
43
45
|
klass_name.split("::").map do |mod_name|
|
@@ -47,7 +49,7 @@ module RbsDraper
|
|
47
49
|
when Class
|
48
50
|
# @type var superclass: Class
|
49
51
|
superclass = _ = mod_object.superclass
|
50
|
-
superclass_name =
|
52
|
+
superclass_name = superclass.name || "Object"
|
51
53
|
|
52
54
|
"class #{mod_name} < ::#{superclass_name}"
|
53
55
|
when Module
|
data/lib/rbs_draper/version.rb
CHANGED
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: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
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: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
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: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
28
28
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
29
29
|
repo_dir: gems
|
30
30
|
- name: activemodel
|
@@ -32,7 +32,7 @@ gems:
|
|
32
32
|
source:
|
33
33
|
type: git
|
34
34
|
name: ruby/gem_rbs_collection
|
35
|
-
revision:
|
35
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
36
36
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
37
37
|
repo_dir: gems
|
38
38
|
- name: activerecord
|
@@ -40,7 +40,7 @@ gems:
|
|
40
40
|
source:
|
41
41
|
type: git
|
42
42
|
name: ruby/gem_rbs_collection
|
43
|
-
revision:
|
43
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
44
44
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
45
45
|
repo_dir: gems
|
46
46
|
- name: activesupport
|
@@ -48,7 +48,7 @@ gems:
|
|
48
48
|
source:
|
49
49
|
type: git
|
50
50
|
name: ruby/gem_rbs_collection
|
51
|
-
revision:
|
51
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
52
52
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
53
53
|
repo_dir: gems
|
54
54
|
- name: ast
|
@@ -56,7 +56,7 @@ gems:
|
|
56
56
|
source:
|
57
57
|
type: git
|
58
58
|
name: ruby/gem_rbs_collection
|
59
|
-
revision:
|
59
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
60
60
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
61
61
|
repo_dir: gems
|
62
62
|
- name: base64
|
@@ -72,13 +72,17 @@ gems:
|
|
72
72
|
source:
|
73
73
|
type: git
|
74
74
|
name: ruby/gem_rbs_collection
|
75
|
-
revision:
|
75
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
76
76
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
77
77
|
repo_dir: gems
|
78
78
|
- name: date
|
79
79
|
version: '0'
|
80
80
|
source:
|
81
81
|
type: stdlib
|
82
|
+
- name: erb
|
83
|
+
version: '0'
|
84
|
+
source:
|
85
|
+
type: stdlib
|
82
86
|
- name: fileutils
|
83
87
|
version: '0'
|
84
88
|
source:
|
@@ -88,7 +92,7 @@ gems:
|
|
88
92
|
source:
|
89
93
|
type: git
|
90
94
|
name: ruby/gem_rbs_collection
|
91
|
-
revision:
|
95
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
92
96
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
93
97
|
repo_dir: gems
|
94
98
|
- name: json
|
@@ -116,7 +120,7 @@ gems:
|
|
116
120
|
source:
|
117
121
|
type: git
|
118
122
|
name: ruby/gem_rbs_collection
|
119
|
-
revision:
|
123
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
120
124
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
121
125
|
repo_dir: gems
|
122
126
|
- name: optparse
|
@@ -128,7 +132,7 @@ gems:
|
|
128
132
|
source:
|
129
133
|
type: git
|
130
134
|
name: ruby/gem_rbs_collection
|
131
|
-
revision:
|
135
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
132
136
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
133
137
|
repo_dir: gems
|
134
138
|
- name: pathname
|
@@ -140,7 +144,7 @@ gems:
|
|
140
144
|
source:
|
141
145
|
type: git
|
142
146
|
name: ruby/gem_rbs_collection
|
143
|
-
revision:
|
147
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
144
148
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
145
149
|
repo_dir: gems
|
146
150
|
- name: rails-dom-testing
|
@@ -148,7 +152,7 @@ gems:
|
|
148
152
|
source:
|
149
153
|
type: git
|
150
154
|
name: ruby/gem_rbs_collection
|
151
|
-
revision:
|
155
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
152
156
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
153
157
|
repo_dir: gems
|
154
158
|
- name: railties
|
@@ -156,7 +160,7 @@ gems:
|
|
156
160
|
source:
|
157
161
|
type: git
|
158
162
|
name: ruby/gem_rbs_collection
|
159
|
-
revision:
|
163
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
160
164
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
161
165
|
repo_dir: gems
|
162
166
|
- name: rainbow
|
@@ -164,17 +168,13 @@ gems:
|
|
164
168
|
source:
|
165
169
|
type: git
|
166
170
|
name: ruby/gem_rbs_collection
|
167
|
-
revision:
|
171
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
168
172
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
169
173
|
repo_dir: gems
|
170
174
|
- name: rbs
|
171
175
|
version: 3.1.3
|
172
176
|
source:
|
173
177
|
type: rubygems
|
174
|
-
- name: rbs_rails
|
175
|
-
version: 0.12.0
|
176
|
-
source:
|
177
|
-
type: rubygems
|
178
178
|
- name: rdoc
|
179
179
|
version: '0'
|
180
180
|
source:
|
@@ -184,7 +184,7 @@ gems:
|
|
184
184
|
source:
|
185
185
|
type: git
|
186
186
|
name: ruby/gem_rbs_collection
|
187
|
-
revision:
|
187
|
+
revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
|
188
188
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
189
189
|
repo_dir: gems
|
190
190
|
- name: securerandom
|
data/rbs_draper.gemspec
CHANGED
@@ -31,7 +31,6 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_dependency "draper"
|
32
32
|
spec.add_dependency "fileutils"
|
33
33
|
spec.add_dependency "rbs"
|
34
|
-
spec.add_dependency "rbs_rails"
|
35
34
|
|
36
35
|
# For more information and examples about making a new gem, check out our
|
37
36
|
# guide at: https://bundler.io/guides/creating_gem.html
|
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: 1.1.
|
4
|
+
version: 1.1.3
|
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-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rbs_rails
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
69
|
description: A RBS files generator for Draper decorators
|
84
70
|
email:
|
85
71
|
- i.tkomiya@gmail.com
|