parlour 4.0.1 → 5.0.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/README.md +208 -20
- data/exe/parlour +45 -6
- data/lib/parlour.rb +27 -1
- data/lib/parlour/conversion/converter.rb +34 -0
- data/lib/parlour/conversion/rbi_to_rbs.rb +223 -0
- data/lib/parlour/detached_rbs_generator.rb +25 -0
- data/lib/parlour/generator.rb +34 -0
- data/lib/parlour/options.rb +71 -0
- data/lib/parlour/rbi_generator.rb +24 -37
- data/lib/parlour/rbi_generator/arbitrary.rb +5 -2
- data/lib/parlour/rbi_generator/attribute.rb +14 -5
- data/lib/parlour/rbi_generator/class_namespace.rb +8 -3
- data/lib/parlour/rbi_generator/constant.rb +17 -6
- data/lib/parlour/rbi_generator/enum_class_namespace.rb +8 -3
- data/lib/parlour/rbi_generator/extend.rb +5 -2
- data/lib/parlour/rbi_generator/include.rb +5 -2
- data/lib/parlour/rbi_generator/method.rb +15 -10
- data/lib/parlour/rbi_generator/module_namespace.rb +7 -2
- data/lib/parlour/rbi_generator/namespace.rb +39 -12
- data/lib/parlour/rbi_generator/parameter.rb +11 -5
- data/lib/parlour/rbi_generator/rbi_object.rb +19 -78
- data/lib/parlour/rbi_generator/struct_class_namespace.rb +9 -2
- data/lib/parlour/rbi_generator/struct_prop.rb +12 -9
- data/lib/parlour/rbi_generator/type_alias.rb +101 -0
- data/lib/parlour/rbs_generator.rb +24 -0
- data/lib/parlour/rbs_generator/arbitrary.rb +92 -0
- data/lib/parlour/rbs_generator/attribute.rb +82 -0
- data/lib/parlour/rbs_generator/block.rb +49 -0
- data/lib/parlour/rbs_generator/class_namespace.rb +106 -0
- data/lib/parlour/rbs_generator/constant.rb +95 -0
- data/lib/parlour/rbs_generator/extend.rb +92 -0
- data/lib/parlour/rbs_generator/include.rb +92 -0
- data/lib/parlour/rbs_generator/interface_namespace.rb +34 -0
- data/lib/parlour/rbs_generator/method.rb +146 -0
- data/lib/parlour/rbs_generator/method_signature.rb +104 -0
- data/lib/parlour/rbs_generator/module_namespace.rb +35 -0
- data/lib/parlour/rbs_generator/namespace.rb +627 -0
- data/lib/parlour/rbs_generator/parameter.rb +145 -0
- data/lib/parlour/rbs_generator/rbs_object.rb +78 -0
- data/lib/parlour/rbs_generator/type_alias.rb +96 -0
- data/lib/parlour/type_parser.rb +152 -0
- data/lib/parlour/typed_object.rb +87 -0
- data/lib/parlour/types.rb +445 -0
- data/lib/parlour/version.rb +1 -1
- data/parlour.gemspec +1 -1
- data/rbi/parlour.rbi +982 -76
- metadata +30 -7
- data/lib/parlour/rbi_generator/options.rb +0 -74
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parlour
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0.beta.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Christiansen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sorbet-runtime
|
@@ -159,9 +159,14 @@ files:
|
|
159
159
|
- exe/parlour
|
160
160
|
- lib/parlour.rb
|
161
161
|
- lib/parlour/conflict_resolver.rb
|
162
|
+
- lib/parlour/conversion/converter.rb
|
163
|
+
- lib/parlour/conversion/rbi_to_rbs.rb
|
162
164
|
- lib/parlour/debugging.rb
|
163
165
|
- lib/parlour/detached_rbi_generator.rb
|
166
|
+
- lib/parlour/detached_rbs_generator.rb
|
167
|
+
- lib/parlour/generator.rb
|
164
168
|
- lib/parlour/kernel_hack.rb
|
169
|
+
- lib/parlour/options.rb
|
165
170
|
- lib/parlour/parse_error.rb
|
166
171
|
- lib/parlour/plugin.rb
|
167
172
|
- lib/parlour/rbi_generator.rb
|
@@ -175,13 +180,31 @@ files:
|
|
175
180
|
- lib/parlour/rbi_generator/method.rb
|
176
181
|
- lib/parlour/rbi_generator/module_namespace.rb
|
177
182
|
- lib/parlour/rbi_generator/namespace.rb
|
178
|
-
- lib/parlour/rbi_generator/options.rb
|
179
183
|
- lib/parlour/rbi_generator/parameter.rb
|
180
184
|
- lib/parlour/rbi_generator/rbi_object.rb
|
181
185
|
- lib/parlour/rbi_generator/struct_class_namespace.rb
|
182
186
|
- lib/parlour/rbi_generator/struct_prop.rb
|
187
|
+
- lib/parlour/rbi_generator/type_alias.rb
|
188
|
+
- lib/parlour/rbs_generator.rb
|
189
|
+
- lib/parlour/rbs_generator/arbitrary.rb
|
190
|
+
- lib/parlour/rbs_generator/attribute.rb
|
191
|
+
- lib/parlour/rbs_generator/block.rb
|
192
|
+
- lib/parlour/rbs_generator/class_namespace.rb
|
193
|
+
- lib/parlour/rbs_generator/constant.rb
|
194
|
+
- lib/parlour/rbs_generator/extend.rb
|
195
|
+
- lib/parlour/rbs_generator/include.rb
|
196
|
+
- lib/parlour/rbs_generator/interface_namespace.rb
|
197
|
+
- lib/parlour/rbs_generator/method.rb
|
198
|
+
- lib/parlour/rbs_generator/method_signature.rb
|
199
|
+
- lib/parlour/rbs_generator/module_namespace.rb
|
200
|
+
- lib/parlour/rbs_generator/namespace.rb
|
201
|
+
- lib/parlour/rbs_generator/parameter.rb
|
202
|
+
- lib/parlour/rbs_generator/rbs_object.rb
|
203
|
+
- lib/parlour/rbs_generator/type_alias.rb
|
183
204
|
- lib/parlour/type_loader.rb
|
184
205
|
- lib/parlour/type_parser.rb
|
206
|
+
- lib/parlour/typed_object.rb
|
207
|
+
- lib/parlour/types.rb
|
185
208
|
- lib/parlour/version.rb
|
186
209
|
- parlour.gemspec
|
187
210
|
- plugin_examples/foobar_plugin.rb
|
@@ -201,12 +224,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
201
224
|
version: '0'
|
202
225
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
203
226
|
requirements:
|
204
|
-
- - "
|
227
|
+
- - ">"
|
205
228
|
- !ruby/object:Gem::Version
|
206
|
-
version:
|
229
|
+
version: 1.3.1
|
207
230
|
requirements: []
|
208
|
-
rubygems_version: 3.
|
231
|
+
rubygems_version: 3.0.3
|
209
232
|
signing_key:
|
210
233
|
specification_version: 4
|
211
|
-
summary:
|
234
|
+
summary: A type information generator, merger and parser for Sorbet and Ruby 3/Steep
|
212
235
|
test_files: []
|
@@ -1,74 +0,0 @@
|
|
1
|
-
# typed: true
|
2
|
-
module Parlour
|
3
|
-
class RbiGenerator
|
4
|
-
# A set of immutable formatting options passed to all calls of
|
5
|
-
# {RbiObject#generate_rbi}.
|
6
|
-
class Options
|
7
|
-
extend T::Sig
|
8
|
-
|
9
|
-
sig { params(break_params: Integer, tab_size: Integer, sort_namespaces: T::Boolean).void }
|
10
|
-
# Creates a new set of formatting options.
|
11
|
-
#
|
12
|
-
# @example Create Options with +break_params+ of +4+ and +tab_size+ of +2+.
|
13
|
-
# Parlour::RbiGenerator::Options.new(break_params: 4, tab_size: 2)
|
14
|
-
#
|
15
|
-
# @param break_params [Integer] If there are at least this many parameters in a
|
16
|
-
# Sorbet +sig+, then it is broken onto separate lines.
|
17
|
-
# @param tab_size [Integer] The number of spaces to use per indent.
|
18
|
-
# @param sort_namespaces [Boolean] Whether to sort all items within a
|
19
|
-
# namespace alphabetically.
|
20
|
-
# @return [void]
|
21
|
-
def initialize(break_params:, tab_size:, sort_namespaces:)
|
22
|
-
@break_params = break_params
|
23
|
-
@tab_size = tab_size
|
24
|
-
@sort_namespaces = sort_namespaces
|
25
|
-
end
|
26
|
-
|
27
|
-
sig { returns(Integer) }
|
28
|
-
# If there are at least this many parameters in a Sorbet +sig+, then it
|
29
|
-
# is broken onto separate lines.
|
30
|
-
#
|
31
|
-
# # With break_params: 5
|
32
|
-
# sig { params(name: String, age: Integer, hobbies: T::Array(String), country: Symbol).void }
|
33
|
-
#
|
34
|
-
# # With break_params: 4
|
35
|
-
# sig do
|
36
|
-
# params(
|
37
|
-
# name: String,
|
38
|
-
# age: Integer,
|
39
|
-
# hobbies: T::Array(String),
|
40
|
-
# country: Symbol
|
41
|
-
# ).void
|
42
|
-
# end
|
43
|
-
#
|
44
|
-
# @return [Integer]
|
45
|
-
attr_reader :break_params
|
46
|
-
|
47
|
-
sig { returns(Integer) }
|
48
|
-
# The number of spaces to use per indent.
|
49
|
-
# @return [Integer]
|
50
|
-
attr_reader :tab_size
|
51
|
-
|
52
|
-
sig { returns(T::Boolean) }
|
53
|
-
# Whether to sort all items within a namespace alphabetically.
|
54
|
-
# Items which are typically grouped together, such as "include" or
|
55
|
-
# "extend" calls, will remain grouped together when sorted.
|
56
|
-
# If true, items are sorted by their name when the RBI is generated.
|
57
|
-
# If false, items are generated in the order they are added to the
|
58
|
-
# namespace.
|
59
|
-
# @return [Boolean]
|
60
|
-
attr_reader :sort_namespaces
|
61
|
-
|
62
|
-
sig { params(level: Integer, str: String).returns(String) }
|
63
|
-
# Returns a string indented to the given indent level, according to the
|
64
|
-
# set {tab_size}.
|
65
|
-
#
|
66
|
-
# @param level [Integer] The indent level, as an integer. 0 is totally unindented.
|
67
|
-
# @param str [String] The string to indent.
|
68
|
-
# @return [String] The indented string.
|
69
|
-
def indented(level, str)
|
70
|
-
" " * (level * tab_size) + str
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|