parlour 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/parlour/rbi_generator/arbitrary.rb +3 -3
- data/lib/parlour/rbi_generator/constant.rb +4 -4
- data/lib/parlour/rbi_generator/extend.rb +4 -4
- data/lib/parlour/rbi_generator/include.rb +4 -4
- data/lib/parlour/rbi_generator/method.rb +35 -20
- data/lib/parlour/rbi_generator/namespace.rb +11 -8
- data/lib/parlour/version.rb +1 -1
- 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: 12b7eca4df3f9c2609ae2f8cabbf07b73a26c66f596ce060aea6f9faec5a494d
|
4
|
+
data.tar.gz: 6ca3cf5d7d22d15fd3270adf78044b4aa8286808074c0e0c9b43b68ef4be0bdb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d90cfc6922e9b4ccea622d31d4cdbfe422e6cd8292cdae12a1b2e70ee51bfd1d1779ae66b1b213c14806e3239306f92e149e2d280387127c66147f570d8e198d
|
7
|
+
data.tar.gz: a9f75203ac84c20e91dd24702c904b79741f1156b4975da43d3078423e316ecb534ae56261a4c949454175ee49ba4d5f44236dcadadcebb6368f00a30d52d937
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file.
|
|
3
3
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
5
5
|
|
6
|
+
## [0.8.0] - 2019-09-14
|
7
|
+
### Added
|
8
|
+
- Methods can now have type parameters specified.
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
- **Breaking change: The `implementation` qualifier is no longer genereated.**
|
12
|
+
Following Sorbet merging `implementation` and `override` into just `override`,
|
13
|
+
the `Method#implementation` and `Method#override` flags will now both generate
|
14
|
+
the `override` qualifier.
|
15
|
+
- The Parlour codebase now uses `override` for both abstract implementation and
|
16
|
+
superclass overriding to conform to this change.
|
17
|
+
|
6
18
|
## [0.7.0] - 2019-09-11
|
7
19
|
### Added
|
8
20
|
- The strictness level can now be specified when generating an RBI, using an
|
@@ -35,7 +35,7 @@ module Parlour
|
|
35
35
|
end
|
36
36
|
|
37
37
|
sig do
|
38
|
-
|
38
|
+
override.params(
|
39
39
|
indent_level: Integer,
|
40
40
|
options: Options
|
41
41
|
).returns(T::Array[String])
|
@@ -50,7 +50,7 @@ module Parlour
|
|
50
50
|
end
|
51
51
|
|
52
52
|
sig do
|
53
|
-
|
53
|
+
override.params(
|
54
54
|
others: T::Array[RbiGenerator::RbiObject]
|
55
55
|
).returns(T::Boolean)
|
56
56
|
end
|
@@ -65,7 +65,7 @@ module Parlour
|
|
65
65
|
end
|
66
66
|
|
67
67
|
sig do
|
68
|
-
|
68
|
+
override.params(
|
69
69
|
others: T::Array[RbiGenerator::RbiObject]
|
70
70
|
).void
|
71
71
|
end
|
@@ -36,7 +36,7 @@ module Parlour
|
|
36
36
|
end
|
37
37
|
|
38
38
|
sig do
|
39
|
-
|
39
|
+
override.params(
|
40
40
|
indent_level: Integer,
|
41
41
|
options: Options
|
42
42
|
).returns(T::Array[String])
|
@@ -51,7 +51,7 @@ module Parlour
|
|
51
51
|
end
|
52
52
|
|
53
53
|
sig do
|
54
|
-
|
54
|
+
override.params(
|
55
55
|
others: T::Array[RbiGenerator::RbiObject]
|
56
56
|
).returns(T::Boolean)
|
57
57
|
end
|
@@ -66,7 +66,7 @@ module Parlour
|
|
66
66
|
end
|
67
67
|
|
68
68
|
sig do
|
69
|
-
|
69
|
+
override.params(
|
70
70
|
others: T::Array[RbiGenerator::RbiObject]
|
71
71
|
).void
|
72
72
|
end
|
@@ -82,7 +82,7 @@ module Parlour
|
|
82
82
|
# We don't need to change anything! We only merge identical constants
|
83
83
|
end
|
84
84
|
|
85
|
-
sig {
|
85
|
+
sig { override.returns(String) }
|
86
86
|
# Returns a human-readable brief string description of this code.
|
87
87
|
#
|
88
88
|
# @return [String]
|
@@ -29,7 +29,7 @@ module Parlour
|
|
29
29
|
end
|
30
30
|
|
31
31
|
sig do
|
32
|
-
|
32
|
+
override.params(
|
33
33
|
indent_level: Integer,
|
34
34
|
options: Options
|
35
35
|
).returns(T::Array[String])
|
@@ -44,7 +44,7 @@ module Parlour
|
|
44
44
|
end
|
45
45
|
|
46
46
|
sig do
|
47
|
-
|
47
|
+
override.params(
|
48
48
|
others: T::Array[RbiGenerator::RbiObject]
|
49
49
|
).returns(T::Boolean)
|
50
50
|
end
|
@@ -59,7 +59,7 @@ module Parlour
|
|
59
59
|
end
|
60
60
|
|
61
61
|
sig do
|
62
|
-
|
62
|
+
override.params(
|
63
63
|
others: T::Array[RbiGenerator::RbiObject]
|
64
64
|
).void
|
65
65
|
end
|
@@ -75,7 +75,7 @@ module Parlour
|
|
75
75
|
# We don't need to change anything! We only merge identical extends
|
76
76
|
end
|
77
77
|
|
78
|
-
sig {
|
78
|
+
sig { override.returns(String) }
|
79
79
|
# Returns a human-readable brief string description of this code.
|
80
80
|
#
|
81
81
|
# @return [String]
|
@@ -29,7 +29,7 @@ module Parlour
|
|
29
29
|
end
|
30
30
|
|
31
31
|
sig do
|
32
|
-
|
32
|
+
override.params(
|
33
33
|
indent_level: Integer,
|
34
34
|
options: Options
|
35
35
|
).returns(T::Array[String])
|
@@ -44,7 +44,7 @@ module Parlour
|
|
44
44
|
end
|
45
45
|
|
46
46
|
sig do
|
47
|
-
|
47
|
+
override.params(
|
48
48
|
others: T::Array[RbiGenerator::RbiObject]
|
49
49
|
).returns(T::Boolean)
|
50
50
|
end
|
@@ -59,7 +59,7 @@ module Parlour
|
|
59
59
|
end
|
60
60
|
|
61
61
|
sig do
|
62
|
-
|
62
|
+
override.params(
|
63
63
|
others: T::Array[RbiGenerator::RbiObject]
|
64
64
|
).void
|
65
65
|
end
|
@@ -75,7 +75,7 @@ module Parlour
|
|
75
75
|
# We don't need to change anything! We only merge identical includes
|
76
76
|
end
|
77
77
|
|
78
|
-
sig {
|
78
|
+
sig { override.returns(String) }
|
79
79
|
# Returns a human-readable brief string description of this code.
|
80
80
|
#
|
81
81
|
# @return [String]
|
@@ -16,6 +16,7 @@ module Parlour
|
|
16
16
|
override: T::Boolean,
|
17
17
|
overridable: T::Boolean,
|
18
18
|
class_method: T::Boolean,
|
19
|
+
type_parameters: T.nilable(T::Array[Symbol]),
|
19
20
|
block: T.nilable(T.proc.params(x: Method).void)
|
20
21
|
).void
|
21
22
|
end
|
@@ -30,16 +31,17 @@ module Parlour
|
|
30
31
|
# @param return_type [String, nil] A Sorbet string of what this method returns, such as
|
31
32
|
# +"String"+ or +"T.untyped"+. Passing nil denotes a void return.
|
32
33
|
# @param abstract [Boolean] Whether this method is abstract.
|
33
|
-
# @param implementation [Boolean] Whether this method is an
|
34
|
-
# parent abstract method.
|
34
|
+
# @param implementation [Boolean] DEPRECATED: Whether this method is an
|
35
|
+
# implementation of a parent abstract method.
|
35
36
|
# @param override [Boolean] Whether this method is overriding a parent overridable
|
36
|
-
# method.
|
37
|
+
# method, or implementing a parent abstract method.
|
37
38
|
# @param overridable [Boolean] Whether this method is overridable by subclasses.
|
38
39
|
# @param class_method [Boolean] Whether this method is a class method; that is, it
|
39
40
|
# it is defined using +self.+.
|
41
|
+
# @param class_method [Array<Symbol>, nil] This method's type parameters.
|
40
42
|
# @param block A block which the new instance yields itself to.
|
41
43
|
# @return [void]
|
42
|
-
def initialize(generator, name, parameters, return_type = nil, abstract: false, implementation: false, override: false, overridable: false, class_method: false, &block)
|
44
|
+
def initialize(generator, name, parameters, return_type = nil, abstract: false, implementation: false, override: false, overridable: false, class_method: false, type_parameters: nil, &block)
|
43
45
|
super(generator, name)
|
44
46
|
@parameters = parameters
|
45
47
|
@return_type = return_type
|
@@ -48,6 +50,7 @@ module Parlour
|
|
48
50
|
@override = override
|
49
51
|
@overridable = overridable
|
50
52
|
@class_method = class_method
|
53
|
+
@type_parameters = type_parameters || []
|
51
54
|
yield_self(&block) if block
|
52
55
|
end
|
53
56
|
|
@@ -59,14 +62,15 @@ module Parlour
|
|
59
62
|
# @return [Boolean]
|
60
63
|
def ==(other)
|
61
64
|
Method === other &&
|
62
|
-
name
|
63
|
-
parameters
|
64
|
-
return_type
|
65
|
-
abstract
|
66
|
-
implementation
|
67
|
-
override
|
68
|
-
overridable
|
69
|
-
class_method
|
65
|
+
name == other.name &&
|
66
|
+
parameters == other.parameters &&
|
67
|
+
return_type == other.return_type &&
|
68
|
+
abstract == other.abstract &&
|
69
|
+
implementation == other.implementation &&
|
70
|
+
override == other.override &&
|
71
|
+
overridable == other.overridable &&
|
72
|
+
class_method == other.class_method &&
|
73
|
+
type_parameters == other.type_parameters
|
70
74
|
end
|
71
75
|
|
72
76
|
sig { returns(T::Array[Parameter]) }
|
@@ -87,11 +91,15 @@ module Parlour
|
|
87
91
|
|
88
92
|
sig { returns(T::Boolean) }
|
89
93
|
# Whether this method is an implementation of a parent abstract method.
|
94
|
+
# @deprecated Removed from Sorbet, as {#override} is used for both
|
95
|
+
# abstract class implementations and superclass overrides. In Parlour,
|
96
|
+
# this will now generate +override+.
|
90
97
|
# @return [Boolean]
|
91
98
|
attr_reader :implementation
|
92
99
|
|
93
100
|
sig { returns(T::Boolean) }
|
94
|
-
# Whether this method is overriding a parent overridable method
|
101
|
+
# Whether this method is overriding a parent overridable method, or
|
102
|
+
# implementing a parent abstract method.
|
95
103
|
# @return [Boolean]
|
96
104
|
attr_reader :override
|
97
105
|
|
@@ -106,8 +114,13 @@ module Parlour
|
|
106
114
|
# @return [Boolean]
|
107
115
|
attr_reader :class_method
|
108
116
|
|
117
|
+
sig { returns(T::Array[Symbol]) }
|
118
|
+
# This method's type parameters.
|
119
|
+
# @return [Array<Symbol>]
|
120
|
+
attr_reader :type_parameters
|
121
|
+
|
109
122
|
sig do
|
110
|
-
|
123
|
+
override.params(
|
111
124
|
indent_level: Integer,
|
112
125
|
options: Options
|
113
126
|
).returns(T::Array[String])
|
@@ -142,7 +155,7 @@ module Parlour
|
|
142
155
|
|
143
156
|
: [options.indented(
|
144
157
|
indent_level,
|
145
|
-
"sig { #{qualifiers}#{
|
158
|
+
"sig { #{parameters.empty? ? qualifiers[0...-1] : qualifiers}#{
|
146
159
|
parameters.empty? ? '' : "params(#{sig_params.join(', ')})"
|
147
160
|
}#{
|
148
161
|
qualifiers.empty? && parameters.empty? ? '' : '.'
|
@@ -154,7 +167,7 @@ module Parlour
|
|
154
167
|
end
|
155
168
|
|
156
169
|
sig do
|
157
|
-
|
170
|
+
override.params(
|
158
171
|
others: T::Array[RbiGenerator::RbiObject]
|
159
172
|
).returns(T::Boolean)
|
160
173
|
end
|
@@ -169,7 +182,7 @@ module Parlour
|
|
169
182
|
end
|
170
183
|
|
171
184
|
sig do
|
172
|
-
|
185
|
+
override.params(
|
173
186
|
others: T::Array[RbiGenerator::RbiObject]
|
174
187
|
).void
|
175
188
|
end
|
@@ -185,7 +198,7 @@ module Parlour
|
|
185
198
|
# We don't need to change anything! We only merge identical methods
|
186
199
|
end
|
187
200
|
|
188
|
-
sig {
|
201
|
+
sig { override.returns(String) }
|
189
202
|
# Returns a human-readable brief string description of this method.
|
190
203
|
#
|
191
204
|
# @return [String]
|
@@ -228,9 +241,11 @@ module Parlour
|
|
228
241
|
def qualifiers
|
229
242
|
result = ''
|
230
243
|
result += 'abstract.' if abstract
|
231
|
-
result += '
|
232
|
-
result += 'override.' if override
|
244
|
+
result += 'override.' if override || implementation
|
233
245
|
result += 'overridable.' if overridable
|
246
|
+
result += "type_parameters(#{
|
247
|
+
type_parameters.map { |t| ":#{t}" }.join(', ')
|
248
|
+
})." if type_parameters.any?
|
234
249
|
result
|
235
250
|
end
|
236
251
|
end
|
@@ -7,7 +7,7 @@ module Parlour
|
|
7
7
|
extend T::Sig
|
8
8
|
|
9
9
|
sig do
|
10
|
-
|
10
|
+
override.overridable.params(
|
11
11
|
indent_level: Integer,
|
12
12
|
options: Options
|
13
13
|
).returns(T::Array[String])
|
@@ -199,6 +199,7 @@ module Parlour
|
|
199
199
|
override: T::Boolean,
|
200
200
|
overridable: T::Boolean,
|
201
201
|
class_method: T::Boolean,
|
202
|
+
type_parameters: T.nilable(T::Array[Symbol]),
|
202
203
|
block: T.nilable(T.proc.params(x: Method).void)
|
203
204
|
).returns(Method)
|
204
205
|
end
|
@@ -212,16 +213,17 @@ module Parlour
|
|
212
213
|
# +"String"+ or +"T.untyped"+. Passing nil denotes a void return.
|
213
214
|
# @param returns [String, nil] Same as return_type.
|
214
215
|
# @param abstract [Boolean] Whether this method is abstract.
|
215
|
-
# @param implementation [Boolean] Whether this method is an
|
216
|
-
# parent abstract method.
|
216
|
+
# @param implementation [Boolean] DEPRECATED: Whether this method is an
|
217
|
+
# implementation of a parent abstract method.
|
217
218
|
# @param override [Boolean] Whether this method is overriding a parent overridable
|
218
|
-
# method.
|
219
|
+
# method, or implementing a parent abstract method.
|
219
220
|
# @param overridable [Boolean] Whether this method is overridable by subclasses.
|
220
221
|
# @param class_method [Boolean] Whether this method is a class method; that is, it
|
221
222
|
# it is defined using +self.+.
|
223
|
+
# @param class_method [Array<Symbol>, nil] This method's type parameters.
|
222
224
|
# @param block A block which the new instance yields itself to.
|
223
225
|
# @return [Method]
|
224
|
-
def create_method(name, parameters: nil, return_type: nil, returns: nil, abstract: false, implementation: false, override: false, overridable: false, class_method: false, &block)
|
226
|
+
def create_method(name, parameters: nil, return_type: nil, returns: nil, abstract: false, implementation: false, override: false, overridable: false, class_method: false, type_parameters: nil, &block)
|
225
227
|
parameters = parameters || []
|
226
228
|
raise 'cannot specify both return_type: and returns:' if return_type && returns
|
227
229
|
return_type ||= returns
|
@@ -235,6 +237,7 @@ module Parlour
|
|
235
237
|
override: override,
|
236
238
|
overridable: overridable,
|
237
239
|
class_method: class_method,
|
240
|
+
type_parameters: type_parameters,
|
238
241
|
&block
|
239
242
|
)
|
240
243
|
move_next_comments(new_method)
|
@@ -476,7 +479,7 @@ module Parlour
|
|
476
479
|
end
|
477
480
|
|
478
481
|
sig do
|
479
|
-
|
482
|
+
override.overridable.params(
|
480
483
|
others: T::Array[RbiGenerator::RbiObject]
|
481
484
|
).returns(T::Boolean)
|
482
485
|
end
|
@@ -493,7 +496,7 @@ module Parlour
|
|
493
496
|
end
|
494
497
|
|
495
498
|
sig do
|
496
|
-
|
499
|
+
override.overridable.params(
|
497
500
|
others: T::Array[RbiGenerator::RbiObject]
|
498
501
|
).void
|
499
502
|
end
|
@@ -511,7 +514,7 @@ module Parlour
|
|
511
514
|
end
|
512
515
|
end
|
513
516
|
|
514
|
-
sig {
|
517
|
+
sig { override.overridable.returns(String) }
|
515
518
|
# Returns a human-readable brief string description of this namespace.
|
516
519
|
#
|
517
520
|
# @return [String]
|
data/lib/parlour/version.rb
CHANGED
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: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Christiansen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sorbet-runtime
|