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
data/lib/parlour/version.rb
CHANGED
data/parlour.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Aaron Christiansen"]
|
10
10
|
spec.email = ["hello@aaronc.cc"]
|
11
11
|
|
12
|
-
spec.summary = %q{
|
12
|
+
spec.summary = %q{A type information generator, merger and parser for Sorbet and Ruby 3/Steep}
|
13
13
|
spec.homepage = "https://github.com/AaronC81/parlour"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
data/rbi/parlour.rbi
CHANGED
@@ -3,7 +3,7 @@ module Kernel
|
|
3
3
|
end
|
4
4
|
|
5
5
|
module Parlour
|
6
|
-
VERSION = '
|
6
|
+
VERSION = '5.0.0.beta.1'
|
7
7
|
|
8
8
|
class ConflictResolver
|
9
9
|
extend T::Sig
|
@@ -19,6 +19,9 @@ module Parlour
|
|
19
19
|
|
20
20
|
sig { params(arr: T::Array[T.untyped]).returns(T::Boolean) }
|
21
21
|
def all_eql?(arr); end
|
22
|
+
|
23
|
+
sig { params(namespace: RbiGenerator::Namespace, name: T.nilable(String)).void }
|
24
|
+
def deduplicate_mixins_of_name(namespace, name); end
|
22
25
|
end
|
23
26
|
|
24
27
|
module Debugging
|
@@ -57,6 +60,52 @@ module Parlour
|
|
57
60
|
end
|
58
61
|
end
|
59
62
|
|
63
|
+
class DetachedRbsGenerator < RbsGenerator
|
64
|
+
sig { returns(T.untyped) }
|
65
|
+
def detached!; end
|
66
|
+
|
67
|
+
sig { override.returns(Options) }
|
68
|
+
def options; end
|
69
|
+
|
70
|
+
sig { override.returns(T.nilable(Plugin)) }
|
71
|
+
def current_plugin; end
|
72
|
+
|
73
|
+
sig { override.returns(String) }
|
74
|
+
def rbs; end
|
75
|
+
end
|
76
|
+
|
77
|
+
class Generator
|
78
|
+
extend T::Sig
|
79
|
+
|
80
|
+
sig { params(break_params: Integer, tab_size: Integer, sort_namespaces: T::Boolean).void }
|
81
|
+
def initialize(break_params: 4, tab_size: 2, sort_namespaces: false); end
|
82
|
+
|
83
|
+
sig { returns(Options) }
|
84
|
+
attr_reader :options
|
85
|
+
|
86
|
+
sig { returns(T.nilable(Plugin)) }
|
87
|
+
attr_accessor :current_plugin
|
88
|
+
end
|
89
|
+
|
90
|
+
class Options
|
91
|
+
extend T::Sig
|
92
|
+
|
93
|
+
sig { params(break_params: Integer, tab_size: Integer, sort_namespaces: T::Boolean).void }
|
94
|
+
def initialize(break_params:, tab_size:, sort_namespaces:); end
|
95
|
+
|
96
|
+
sig { returns(Integer) }
|
97
|
+
attr_reader :break_params
|
98
|
+
|
99
|
+
sig { returns(Integer) }
|
100
|
+
attr_reader :tab_size
|
101
|
+
|
102
|
+
sig { returns(T::Boolean) }
|
103
|
+
attr_reader :sort_namespaces
|
104
|
+
|
105
|
+
sig { params(level: Integer, str: String).returns(String) }
|
106
|
+
def indented(level, str); end
|
107
|
+
end
|
108
|
+
|
60
109
|
class ParseError < StandardError
|
61
110
|
extend T::Sig
|
62
111
|
|
@@ -181,6 +230,15 @@ module Parlour
|
|
181
230
|
sig { params(path: NodePath, is_within_eigenclass: T::Boolean).returns(T::Array[RbiGenerator::Method]) }
|
182
231
|
def parse_method_into_methods(path, is_within_eigenclass: false); end
|
183
232
|
|
233
|
+
sig { params(str: String).returns(Types::Type) }
|
234
|
+
def self.parse_single_type(str); end
|
235
|
+
|
236
|
+
sig { params(node: Parser::AST::Node).returns(Types::Type) }
|
237
|
+
def parse_node_to_type(node); end
|
238
|
+
|
239
|
+
sig { params(msg: String, node: Parser::AST::Node).void }
|
240
|
+
def warning(msg, node); end
|
241
|
+
|
184
242
|
sig { params(node: T.nilable(Parser::AST::Node)).returns(T::Array[Symbol]) }
|
185
243
|
def constant_names(node); end
|
186
244
|
|
@@ -213,26 +271,364 @@ module Parlour
|
|
213
271
|
def zip_by(a, fa, b, fb); end
|
214
272
|
end
|
215
273
|
|
216
|
-
class
|
274
|
+
class TypedObject
|
275
|
+
abstract!
|
276
|
+
|
217
277
|
extend T::Sig
|
278
|
+
extend T::Helpers
|
218
279
|
|
219
|
-
sig { params(
|
220
|
-
def initialize(
|
280
|
+
sig { params(name: String).void }
|
281
|
+
def initialize(name); end
|
221
282
|
|
222
|
-
sig { returns(
|
223
|
-
attr_reader :
|
283
|
+
sig { returns(T.nilable(Plugin)) }
|
284
|
+
attr_reader :generated_by
|
224
285
|
|
225
|
-
sig { returns(
|
226
|
-
attr_reader :
|
286
|
+
sig { returns(String) }
|
287
|
+
attr_reader :name
|
227
288
|
|
228
|
-
sig { returns(T
|
229
|
-
|
289
|
+
sig { returns(T::Array[String]) }
|
290
|
+
attr_reader :comments
|
291
|
+
|
292
|
+
sig { params(comment: T.any(String, T::Array[String])).void }
|
293
|
+
def add_comment(comment); end
|
294
|
+
|
295
|
+
sig { abstract.returns(String) }
|
296
|
+
def describe; end
|
297
|
+
|
298
|
+
sig { params(indent_level: Integer, options: Options).returns(T::Array[String]) }
|
299
|
+
def generate_comments(indent_level, options); end
|
300
|
+
end
|
301
|
+
|
302
|
+
module Types
|
303
|
+
TypeLike = T.type_alias { T.any(String, Type) }
|
304
|
+
|
305
|
+
class Type
|
306
|
+
abstract!
|
307
|
+
|
308
|
+
extend T::Sig
|
309
|
+
extend T::Helpers
|
310
|
+
|
311
|
+
sig { abstract.returns(String) }
|
312
|
+
def generate_rbi; end
|
313
|
+
|
314
|
+
sig { abstract.returns(String) }
|
315
|
+
def generate_rbs; end
|
316
|
+
|
317
|
+
sig { params(type_like: TypeLike).returns(Type) }
|
318
|
+
def self.to_type(type_like); end
|
319
|
+
|
320
|
+
sig { params(type_like: TypeLike).returns(Type) }
|
321
|
+
def to_type(type_like); end
|
322
|
+
end
|
323
|
+
|
324
|
+
class Raw < Type
|
325
|
+
sig { params(str: String).void }
|
326
|
+
def initialize(str); end
|
327
|
+
|
328
|
+
sig { returns(String) }
|
329
|
+
attr_reader :str
|
330
|
+
|
331
|
+
sig { params(other: Object).returns(T::Boolean) }
|
332
|
+
def ==(other); end
|
333
|
+
|
334
|
+
sig { override.returns(String) }
|
335
|
+
def generate_rbi; end
|
336
|
+
|
337
|
+
sig { override.returns(String) }
|
338
|
+
def generate_rbs; end
|
339
|
+
end
|
340
|
+
|
341
|
+
class Nilable < Type
|
342
|
+
sig { params(type: TypeLike).void }
|
343
|
+
def initialize(type); end
|
344
|
+
|
345
|
+
sig { params(other: Object).returns(T::Boolean) }
|
346
|
+
def ==(other); end
|
347
|
+
|
348
|
+
sig { returns(Type) }
|
349
|
+
attr_reader :type
|
350
|
+
|
351
|
+
sig { override.returns(String) }
|
352
|
+
def generate_rbi; end
|
353
|
+
|
354
|
+
sig { override.returns(String) }
|
355
|
+
def generate_rbs; end
|
356
|
+
end
|
357
|
+
|
358
|
+
class Union < Type
|
359
|
+
sig { params(types: T::Array[TypeLike]).void }
|
360
|
+
def initialize(types); end
|
361
|
+
|
362
|
+
sig { params(other: Object).returns(T::Boolean) }
|
363
|
+
def ==(other); end
|
364
|
+
|
365
|
+
sig { returns(T::Array[Type]) }
|
366
|
+
attr_reader :types
|
367
|
+
|
368
|
+
sig { override.returns(String) }
|
369
|
+
def generate_rbi; end
|
370
|
+
|
371
|
+
sig { override.returns(String) }
|
372
|
+
def generate_rbs; end
|
373
|
+
end
|
374
|
+
|
375
|
+
class Intersection < Type
|
376
|
+
sig { params(types: T::Array[TypeLike]).void }
|
377
|
+
def initialize(types); end
|
378
|
+
|
379
|
+
sig { params(other: Object).returns(T::Boolean) }
|
380
|
+
def ==(other); end
|
381
|
+
|
382
|
+
sig { returns(T::Array[Type]) }
|
383
|
+
attr_reader :types
|
384
|
+
|
385
|
+
sig { override.returns(String) }
|
386
|
+
def generate_rbi; end
|
387
|
+
|
388
|
+
sig { override.returns(String) }
|
389
|
+
def generate_rbs; end
|
390
|
+
end
|
391
|
+
|
392
|
+
class Tuple < Type
|
393
|
+
sig { params(types: T::Array[TypeLike]).void }
|
394
|
+
def initialize(types); end
|
395
|
+
|
396
|
+
sig { params(other: Object).returns(T::Boolean) }
|
397
|
+
def ==(other); end
|
398
|
+
|
399
|
+
sig { returns(T::Array[Type]) }
|
400
|
+
attr_reader :types
|
401
|
+
|
402
|
+
sig { override.returns(String) }
|
403
|
+
def generate_rbi; end
|
404
|
+
|
405
|
+
sig { override.returns(String) }
|
406
|
+
def generate_rbs; end
|
407
|
+
end
|
408
|
+
|
409
|
+
class SingleElementCollection < Type
|
410
|
+
abstract!
|
411
|
+
|
412
|
+
sig { params(element: TypeLike).void }
|
413
|
+
def initialize(element); end
|
414
|
+
|
415
|
+
sig { returns(Type) }
|
416
|
+
attr_reader :element
|
417
|
+
|
418
|
+
sig { abstract.returns(String) }
|
419
|
+
def collection_name; end
|
420
|
+
|
421
|
+
sig { override.returns(String) }
|
422
|
+
def generate_rbi; end
|
423
|
+
|
424
|
+
sig { override.returns(String) }
|
425
|
+
def generate_rbs; end
|
426
|
+
end
|
427
|
+
|
428
|
+
class Array < SingleElementCollection
|
429
|
+
sig { override.returns(String) }
|
430
|
+
def collection_name; end
|
431
|
+
|
432
|
+
sig { params(other: Object).returns(T::Boolean) }
|
433
|
+
def ==(other); end
|
434
|
+
end
|
435
|
+
|
436
|
+
class Set < SingleElementCollection
|
437
|
+
sig { override.returns(String) }
|
438
|
+
def collection_name; end
|
439
|
+
|
440
|
+
sig { params(other: Object).returns(T::Boolean) }
|
441
|
+
def ==(other); end
|
442
|
+
end
|
443
|
+
|
444
|
+
class Range < SingleElementCollection
|
445
|
+
sig { override.returns(String) }
|
446
|
+
def collection_name; end
|
447
|
+
|
448
|
+
sig { params(other: Object).returns(T::Boolean) }
|
449
|
+
def ==(other); end
|
450
|
+
end
|
451
|
+
|
452
|
+
class Enumerable < SingleElementCollection
|
453
|
+
sig { override.returns(String) }
|
454
|
+
def collection_name; end
|
455
|
+
|
456
|
+
sig { params(other: Object).returns(T::Boolean) }
|
457
|
+
def ==(other); end
|
458
|
+
end
|
459
|
+
|
460
|
+
class Enumerator < SingleElementCollection
|
461
|
+
sig { override.returns(String) }
|
462
|
+
def collection_name; end
|
463
|
+
|
464
|
+
sig { params(other: Object).returns(T::Boolean) }
|
465
|
+
def ==(other); end
|
466
|
+
end
|
467
|
+
|
468
|
+
class Hash < Type
|
469
|
+
sig { params(key: TypeLike, value: TypeLike).void }
|
470
|
+
def initialize(key, value); end
|
471
|
+
|
472
|
+
sig { params(other: Object).returns(T::Boolean) }
|
473
|
+
def ==(other); end
|
474
|
+
|
475
|
+
sig { returns(Type) }
|
476
|
+
attr_reader :key
|
477
|
+
|
478
|
+
sig { returns(Type) }
|
479
|
+
attr_reader :value
|
480
|
+
|
481
|
+
sig { override.returns(String) }
|
482
|
+
def generate_rbi; end
|
483
|
+
|
484
|
+
sig { override.returns(String) }
|
485
|
+
def generate_rbs; end
|
486
|
+
end
|
487
|
+
|
488
|
+
class Record < Type
|
489
|
+
sig { params(keys_to_types: T::Hash[Symbol, TypeLike]).void }
|
490
|
+
def initialize(keys_to_types); end
|
491
|
+
|
492
|
+
sig { params(other: Object).returns(T::Boolean) }
|
493
|
+
def ==(other); end
|
494
|
+
|
495
|
+
sig { returns(T::Hash[Symbol, Type]) }
|
496
|
+
attr_reader :keys_to_types
|
497
|
+
|
498
|
+
sig { override.returns(String) }
|
499
|
+
def generate_rbi; end
|
500
|
+
|
501
|
+
sig { override.returns(String) }
|
502
|
+
def generate_rbs; end
|
503
|
+
end
|
504
|
+
|
505
|
+
class Class < Type
|
506
|
+
sig { params(type: TypeLike).void }
|
507
|
+
def initialize(type); end
|
508
|
+
|
509
|
+
sig { params(other: Object).returns(T::Boolean) }
|
510
|
+
def ==(other); end
|
511
|
+
|
512
|
+
sig { returns(Type) }
|
513
|
+
attr_reader :type
|
514
|
+
|
515
|
+
sig { override.returns(String) }
|
516
|
+
def generate_rbi; end
|
517
|
+
|
518
|
+
sig { override.returns(String) }
|
519
|
+
def generate_rbs; end
|
520
|
+
end
|
521
|
+
|
522
|
+
class Boolean < Type
|
523
|
+
sig { params(other: Object).returns(T::Boolean) }
|
524
|
+
def ==(other); end
|
525
|
+
|
526
|
+
sig { override.returns(String) }
|
527
|
+
def generate_rbi; end
|
528
|
+
|
529
|
+
sig { override.returns(String) }
|
530
|
+
def generate_rbs; end
|
531
|
+
end
|
532
|
+
|
533
|
+
class Untyped < Type
|
534
|
+
sig { params(other: Object).returns(T::Boolean) }
|
535
|
+
def ==(other); end
|
536
|
+
|
537
|
+
sig { override.returns(String) }
|
538
|
+
def generate_rbi; end
|
539
|
+
|
540
|
+
sig { override.returns(String) }
|
541
|
+
def generate_rbs; end
|
542
|
+
end
|
543
|
+
|
544
|
+
class Proc < Type
|
545
|
+
class Parameter
|
546
|
+
extend T::Sig
|
547
|
+
|
548
|
+
sig { params(name: String, type: TypeLike, default: T.nilable(String)).void }
|
549
|
+
def initialize(name, type, default = nil); end
|
550
|
+
|
551
|
+
sig { returns(String) }
|
552
|
+
attr_reader :name
|
553
|
+
|
554
|
+
sig { returns(Type) }
|
555
|
+
attr_reader :type
|
556
|
+
|
557
|
+
sig { returns(T.nilable(String)) }
|
558
|
+
attr_reader :default
|
559
|
+
|
560
|
+
sig { params(other: Object).returns(T::Boolean) }
|
561
|
+
def ==(other); end
|
562
|
+
end
|
563
|
+
|
564
|
+
sig { params(parameters: T::Array[Parameter], return_type: T.nilable(TypeLike)).void }
|
565
|
+
def initialize(parameters, return_type); end
|
566
|
+
|
567
|
+
sig { params(other: Object).returns(T::Boolean) }
|
568
|
+
def ==(other); end
|
569
|
+
|
570
|
+
sig { returns(T::Array[Parameter]) }
|
571
|
+
attr_reader :parameters
|
572
|
+
|
573
|
+
sig { returns(T.nilable(Type)) }
|
574
|
+
attr_reader :return_type
|
575
|
+
|
576
|
+
sig { override.returns(String) }
|
577
|
+
def generate_rbi; end
|
578
|
+
|
579
|
+
sig { override.returns(String) }
|
580
|
+
def generate_rbs; end
|
581
|
+
end
|
582
|
+
end
|
583
|
+
|
584
|
+
module Conversion
|
585
|
+
class Converter
|
586
|
+
abstract!
|
587
|
+
|
588
|
+
extend T::Sig
|
589
|
+
extend T::Helpers
|
590
|
+
|
591
|
+
sig { returns(T.untyped) }
|
592
|
+
def initialize; end
|
593
|
+
|
594
|
+
sig { returns(T::Array[[String, TypedObject]]) }
|
595
|
+
attr_reader :warnings
|
596
|
+
|
597
|
+
sig { params(msg: String, node: RbiGenerator::RbiObject).void }
|
598
|
+
def add_warning(msg, node); end
|
599
|
+
end
|
600
|
+
|
601
|
+
class RbiToRbs < Converter
|
602
|
+
extend T::Sig
|
603
|
+
|
604
|
+
sig { params(rbs_gen: RbsGenerator).void }
|
605
|
+
def initialize(rbs_gen); end
|
606
|
+
|
607
|
+
sig { returns(RbsGenerator) }
|
608
|
+
attr_reader :rbs_gen
|
609
|
+
|
610
|
+
sig { params(from: RbiGenerator::Namespace, to: RbsGenerator::Namespace).void }
|
611
|
+
def convert_all(from, to); end
|
612
|
+
|
613
|
+
sig { params(node: RbiGenerator::RbiObject, new_parent: RbsGenerator::Namespace).void }
|
614
|
+
def convert_object(node, new_parent); end
|
615
|
+
end
|
616
|
+
end
|
617
|
+
|
618
|
+
class RbiGenerator < Generator
|
619
|
+
Options = Parlour::Options
|
620
|
+
|
621
|
+
sig { params(hash: T.untyped).returns(T.untyped) }
|
622
|
+
def initialize(**hash); end
|
623
|
+
|
624
|
+
sig { returns(RbiGenerator::Namespace) }
|
625
|
+
attr_reader :root
|
230
626
|
|
231
627
|
sig { overridable.params(strictness: String).returns(String) }
|
232
628
|
def rbi(strictness = 'strong'); end
|
233
629
|
|
234
630
|
class Arbitrary < RbiObject
|
235
|
-
sig { params(generator:
|
631
|
+
sig { params(generator: Generator, code: String, block: T.nilable(T.proc.params(x: Arbitrary).void)).void }
|
236
632
|
def initialize(generator, code: '', &block); end
|
237
633
|
|
238
634
|
sig { returns(String) }
|
@@ -252,15 +648,18 @@ module Parlour
|
|
252
648
|
|
253
649
|
sig { override.returns(String) }
|
254
650
|
def describe; end
|
651
|
+
|
652
|
+
sig { override.void }
|
653
|
+
def generalize_from_rbi!; end
|
255
654
|
end
|
256
655
|
|
257
656
|
class Attribute < Method
|
258
657
|
sig do
|
259
658
|
params(
|
260
|
-
generator:
|
659
|
+
generator: Generator,
|
261
660
|
name: String,
|
262
661
|
kind: Symbol,
|
263
|
-
type:
|
662
|
+
type: Types::TypeLike,
|
264
663
|
class_attribute: T::Boolean,
|
265
664
|
block: T.nilable(T.proc.params(x: Attribute).void)
|
266
665
|
).void
|
@@ -273,9 +672,15 @@ module Parlour
|
|
273
672
|
sig { returns(T::Boolean) }
|
274
673
|
attr_reader :class_attribute
|
275
674
|
|
675
|
+
sig { returns(Types::TypeLike) }
|
676
|
+
attr_reader :type
|
677
|
+
|
276
678
|
sig { override.params(other: Object).returns(T::Boolean) }
|
277
679
|
def ==(other); end
|
278
680
|
|
681
|
+
sig { override.void }
|
682
|
+
def generalize_from_rbi!; end
|
683
|
+
|
279
684
|
sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
|
280
685
|
def generate_definition(indent_level, options); end
|
281
686
|
end
|
@@ -285,7 +690,7 @@ module Parlour
|
|
285
690
|
|
286
691
|
sig do
|
287
692
|
params(
|
288
|
-
generator:
|
693
|
+
generator: Generator,
|
289
694
|
name: String,
|
290
695
|
final: T::Boolean,
|
291
696
|
superclass: T.nilable(String),
|
@@ -312,21 +717,24 @@ module Parlour
|
|
312
717
|
|
313
718
|
sig { override.returns(String) }
|
314
719
|
def describe; end
|
720
|
+
|
721
|
+
sig { override.void }
|
722
|
+
def generalize_from_rbi!; end
|
315
723
|
end
|
316
724
|
|
317
725
|
class Constant < RbiObject
|
318
726
|
sig do
|
319
727
|
params(
|
320
|
-
generator:
|
728
|
+
generator: Generator,
|
321
729
|
name: String,
|
322
|
-
value:
|
730
|
+
value: Types::TypeLike,
|
323
731
|
eigen_constant: T::Boolean,
|
324
732
|
block: T.nilable(T.proc.params(x: Constant).void)
|
325
733
|
).void
|
326
734
|
end
|
327
735
|
def initialize(generator, name: '', value: '', eigen_constant: false, &block); end
|
328
736
|
|
329
|
-
sig { returns(
|
737
|
+
sig { returns(Types::TypeLike) }
|
330
738
|
attr_reader :value
|
331
739
|
|
332
740
|
sig { returns(T.untyped) }
|
@@ -346,6 +754,9 @@ module Parlour
|
|
346
754
|
|
347
755
|
sig { override.returns(String) }
|
348
756
|
def describe; end
|
757
|
+
|
758
|
+
sig { override.void }
|
759
|
+
def generalize_from_rbi!; end
|
349
760
|
end
|
350
761
|
|
351
762
|
class EnumClassNamespace < ClassNamespace
|
@@ -353,7 +764,7 @@ module Parlour
|
|
353
764
|
|
354
765
|
sig do
|
355
766
|
params(
|
356
|
-
generator:
|
767
|
+
generator: Generator,
|
357
768
|
name: String,
|
358
769
|
final: T::Boolean,
|
359
770
|
enums: T::Array[T.any([String, String], String)],
|
@@ -374,10 +785,13 @@ module Parlour
|
|
374
785
|
|
375
786
|
sig { override.params(others: T::Array[RbiGenerator::RbiObject]).void }
|
376
787
|
def merge_into_self(others); end
|
788
|
+
|
789
|
+
sig { override.void }
|
790
|
+
def generalize_from_rbi!; end
|
377
791
|
end
|
378
792
|
|
379
793
|
class Extend < RbiObject
|
380
|
-
sig { params(generator:
|
794
|
+
sig { params(generator: Generator, name: String, block: T.nilable(T.proc.params(x: Extend).void)).void }
|
381
795
|
def initialize(generator, name: '', &block); end
|
382
796
|
|
383
797
|
sig { params(other: Object).returns(T::Boolean) }
|
@@ -394,10 +808,13 @@ module Parlour
|
|
394
808
|
|
395
809
|
sig { override.returns(String) }
|
396
810
|
def describe; end
|
811
|
+
|
812
|
+
sig { override.void }
|
813
|
+
def generalize_from_rbi!; end
|
397
814
|
end
|
398
815
|
|
399
816
|
class Include < RbiObject
|
400
|
-
sig { params(generator:
|
817
|
+
sig { params(generator: Generator, name: String, block: T.nilable(T.proc.params(x: Include).void)).void }
|
401
818
|
def initialize(generator, name: '', &block); end
|
402
819
|
|
403
820
|
sig { params(other: Object).returns(T::Boolean) }
|
@@ -414,6 +831,9 @@ module Parlour
|
|
414
831
|
|
415
832
|
sig { override.returns(String) }
|
416
833
|
def describe; end
|
834
|
+
|
835
|
+
sig { override.void }
|
836
|
+
def generalize_from_rbi!; end
|
417
837
|
end
|
418
838
|
|
419
839
|
class Method < RbiObject
|
@@ -421,10 +841,10 @@ module Parlour
|
|
421
841
|
|
422
842
|
sig do
|
423
843
|
params(
|
424
|
-
generator:
|
844
|
+
generator: Generator,
|
425
845
|
name: String,
|
426
846
|
parameters: T::Array[Parameter],
|
427
|
-
return_type: T.nilable(
|
847
|
+
return_type: T.nilable(Types::TypeLike),
|
428
848
|
abstract: T::Boolean,
|
429
849
|
implementation: T::Boolean,
|
430
850
|
override: T::Boolean,
|
@@ -443,7 +863,7 @@ module Parlour
|
|
443
863
|
sig { returns(T::Array[Parameter]) }
|
444
864
|
attr_reader :parameters
|
445
865
|
|
446
|
-
sig { returns(T.nilable(
|
866
|
+
sig { returns(T.nilable(Types::TypeLike)) }
|
447
867
|
attr_reader :return_type
|
448
868
|
|
449
869
|
sig { returns(T::Boolean) }
|
@@ -479,6 +899,9 @@ module Parlour
|
|
479
899
|
sig { override.returns(String) }
|
480
900
|
def describe; end
|
481
901
|
|
902
|
+
sig { override.void }
|
903
|
+
def generalize_from_rbi!; end
|
904
|
+
|
482
905
|
sig { overridable.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
|
483
906
|
def generate_definition(indent_level, options); end
|
484
907
|
|
@@ -491,7 +914,7 @@ module Parlour
|
|
491
914
|
|
492
915
|
sig do
|
493
916
|
params(
|
494
|
-
generator:
|
917
|
+
generator: Generator,
|
495
918
|
name: String,
|
496
919
|
final: T::Boolean,
|
497
920
|
interface: T::Boolean,
|
@@ -514,6 +937,9 @@ module Parlour
|
|
514
937
|
|
515
938
|
sig { override.returns(String) }
|
516
939
|
def describe; end
|
940
|
+
|
941
|
+
sig { override.void }
|
942
|
+
def generalize_from_rbi!; end
|
517
943
|
end
|
518
944
|
|
519
945
|
class Namespace < RbiObject
|
@@ -524,7 +950,7 @@ module Parlour
|
|
524
950
|
|
525
951
|
sig do
|
526
952
|
params(
|
527
|
-
generator:
|
953
|
+
generator: Generator,
|
528
954
|
name: T.nilable(String),
|
529
955
|
final: T::Boolean,
|
530
956
|
block: T.nilable(T.proc.params(x: Namespace).void)
|
@@ -544,6 +970,9 @@ module Parlour
|
|
544
970
|
sig { returns(T::Array[RbiGenerator::Include]) }
|
545
971
|
def includes; end
|
546
972
|
|
973
|
+
sig { returns(T::Array[RbiGenerator::TypeAlias]) }
|
974
|
+
def aliases; end
|
975
|
+
|
547
976
|
sig { returns(T::Array[RbiGenerator::Constant]) }
|
548
977
|
def constants; end
|
549
978
|
|
@@ -600,7 +1029,7 @@ module Parlour
|
|
600
1029
|
params(
|
601
1030
|
name: String,
|
602
1031
|
parameters: T.nilable(T::Array[Parameter]),
|
603
|
-
return_type: T.nilable(
|
1032
|
+
return_type: T.nilable(Types::TypeLike),
|
604
1033
|
returns: T.nilable(String),
|
605
1034
|
abstract: T::Boolean,
|
606
1035
|
implementation: T::Boolean,
|
@@ -618,7 +1047,7 @@ module Parlour
|
|
618
1047
|
params(
|
619
1048
|
name: String,
|
620
1049
|
kind: Symbol,
|
621
|
-
type:
|
1050
|
+
type: Types::TypeLike,
|
622
1051
|
class_attribute: T::Boolean,
|
623
1052
|
block: T.nilable(T.proc.params(x: Attribute).void)
|
624
1053
|
).returns(Attribute)
|
@@ -628,7 +1057,7 @@ module Parlour
|
|
628
1057
|
sig do
|
629
1058
|
params(
|
630
1059
|
name: String,
|
631
|
-
type:
|
1060
|
+
type: Types::TypeLike,
|
632
1061
|
class_attribute: T::Boolean,
|
633
1062
|
block: T.nilable(T.proc.params(x: Attribute).void)
|
634
1063
|
).returns(Attribute)
|
@@ -638,7 +1067,7 @@ module Parlour
|
|
638
1067
|
sig do
|
639
1068
|
params(
|
640
1069
|
name: String,
|
641
|
-
type:
|
1070
|
+
type: Types::TypeLike,
|
642
1071
|
class_attribute: T::Boolean,
|
643
1072
|
block: T.nilable(T.proc.params(x: Attribute).void)
|
644
1073
|
).returns(Attribute)
|
@@ -648,7 +1077,7 @@ module Parlour
|
|
648
1077
|
sig do
|
649
1078
|
params(
|
650
1079
|
name: String,
|
651
|
-
type:
|
1080
|
+
type: Types::TypeLike,
|
652
1081
|
class_attribute: T::Boolean,
|
653
1082
|
block: T.nilable(T.proc.params(x: Attribute).void)
|
654
1083
|
).returns(Attribute)
|
@@ -680,7 +1109,7 @@ module Parlour
|
|
680
1109
|
end
|
681
1110
|
def create_constant(name, value:, eigen_constant: false, &block); end
|
682
1111
|
|
683
|
-
sig { params(name: String, type:
|
1112
|
+
sig { params(name: String, type: Types::TypeLike, block: T.nilable(T.proc.params(x: TypeAlias).void)).returns(TypeAlias) }
|
684
1113
|
def create_type_alias(name, type:, &block); end
|
685
1114
|
|
686
1115
|
sig { override.overridable.params(others: T::Array[RbiGenerator::RbiObject]).returns(T::Boolean) }
|
@@ -692,6 +1121,9 @@ module Parlour
|
|
692
1121
|
sig { override.overridable.returns(String) }
|
693
1122
|
def describe; end
|
694
1123
|
|
1124
|
+
sig { override.void }
|
1125
|
+
def generalize_from_rbi!; end
|
1126
|
+
|
695
1127
|
sig { overridable.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
|
696
1128
|
def generate_body(indent_level, options); end
|
697
1129
|
|
@@ -699,25 +1131,6 @@ module Parlour
|
|
699
1131
|
def move_next_comments(object); end
|
700
1132
|
end
|
701
1133
|
|
702
|
-
class Options
|
703
|
-
extend T::Sig
|
704
|
-
|
705
|
-
sig { params(break_params: Integer, tab_size: Integer, sort_namespaces: T::Boolean).void }
|
706
|
-
def initialize(break_params:, tab_size:, sort_namespaces:); end
|
707
|
-
|
708
|
-
sig { returns(Integer) }
|
709
|
-
attr_reader :break_params
|
710
|
-
|
711
|
-
sig { returns(Integer) }
|
712
|
-
attr_reader :tab_size
|
713
|
-
|
714
|
-
sig { returns(T::Boolean) }
|
715
|
-
attr_reader :sort_namespaces
|
716
|
-
|
717
|
-
sig { params(level: Integer, str: String).returns(String) }
|
718
|
-
def indented(level, str); end
|
719
|
-
end
|
720
|
-
|
721
1134
|
class Parameter
|
722
1135
|
extend T::Sig
|
723
1136
|
PREFIXES = {
|
@@ -727,7 +1140,7 @@ module Parlour
|
|
727
1140
|
block: '&'
|
728
1141
|
}.freeze
|
729
1142
|
|
730
|
-
sig { params(name: String, type: T.nilable(
|
1143
|
+
sig { params(name: String, type: T.nilable(Types::TypeLike), default: T.nilable(String)).void }
|
731
1144
|
def initialize(name, type: nil, default: nil); end
|
732
1145
|
|
733
1146
|
sig { params(other: Object).returns(T::Boolean) }
|
@@ -739,7 +1152,7 @@ module Parlour
|
|
739
1152
|
sig { returns(String) }
|
740
1153
|
def name_without_kind; end
|
741
1154
|
|
742
|
-
sig { returns(
|
1155
|
+
sig { returns(Types::TypeLike) }
|
743
1156
|
attr_reader :type
|
744
1157
|
|
745
1158
|
sig { returns(T.nilable(String)) }
|
@@ -753,32 +1166,20 @@ module Parlour
|
|
753
1166
|
|
754
1167
|
sig { returns(String) }
|
755
1168
|
def to_sig_param; end
|
1169
|
+
|
1170
|
+
sig { void }
|
1171
|
+
def generalize_from_rbi!; end
|
756
1172
|
end
|
757
1173
|
|
758
|
-
class RbiObject
|
1174
|
+
class RbiObject < TypedObject
|
759
1175
|
abstract!
|
760
1176
|
|
761
|
-
|
762
|
-
extend T::Sig
|
763
|
-
|
764
|
-
sig { params(generator: RbiGenerator, name: String).void }
|
1177
|
+
sig { params(generator: Generator, name: String).void }
|
765
1178
|
def initialize(generator, name); end
|
766
1179
|
|
767
|
-
sig { returns(
|
1180
|
+
sig { returns(Generator) }
|
768
1181
|
attr_reader :generator
|
769
1182
|
|
770
|
-
sig { returns(T.nilable(Plugin)) }
|
771
|
-
attr_reader :generated_by
|
772
|
-
|
773
|
-
sig { returns(String) }
|
774
|
-
attr_reader :name
|
775
|
-
|
776
|
-
sig { returns(T::Array[String]) }
|
777
|
-
attr_reader :comments
|
778
|
-
|
779
|
-
sig { params(comment: T.any(String, T::Array[String])).void }
|
780
|
-
def add_comment(comment); end
|
781
|
-
|
782
1183
|
sig { abstract.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
|
783
1184
|
def generate_rbi(indent_level, options); end
|
784
1185
|
|
@@ -788,11 +1189,11 @@ module Parlour
|
|
788
1189
|
sig { abstract.params(others: T::Array[RbiGenerator::RbiObject]).void }
|
789
1190
|
def merge_into_self(others); end
|
790
1191
|
|
791
|
-
sig {
|
1192
|
+
sig { override.overridable.returns(String) }
|
792
1193
|
def describe; end
|
793
1194
|
|
794
|
-
sig {
|
795
|
-
def
|
1195
|
+
sig { abstract.void }
|
1196
|
+
def generalize_from_rbi!; end
|
796
1197
|
end
|
797
1198
|
|
798
1199
|
class StructClassNamespace < ClassNamespace
|
@@ -800,7 +1201,7 @@ module Parlour
|
|
800
1201
|
|
801
1202
|
sig do
|
802
1203
|
params(
|
803
|
-
generator:
|
1204
|
+
generator: Generator,
|
804
1205
|
name: String,
|
805
1206
|
final: T::Boolean,
|
806
1207
|
props: T::Array[StructProp],
|
@@ -821,6 +1222,9 @@ module Parlour
|
|
821
1222
|
|
822
1223
|
sig { override.params(others: T::Array[RbiGenerator::RbiObject]).void }
|
823
1224
|
def merge_into_self(others); end
|
1225
|
+
|
1226
|
+
sig { override.void }
|
1227
|
+
def generalize_from_rbi!; end
|
824
1228
|
end
|
825
1229
|
|
826
1230
|
class StructProp
|
@@ -832,7 +1236,7 @@ module Parlour
|
|
832
1236
|
sig do
|
833
1237
|
params(
|
834
1238
|
name: String,
|
835
|
-
type:
|
1239
|
+
type: Types::TypeLike,
|
836
1240
|
optional: T.nilable(T.any(T::Boolean, Symbol)),
|
837
1241
|
enum: T.nilable(String),
|
838
1242
|
dont_store: T.nilable(T::Boolean),
|
@@ -853,7 +1257,7 @@ module Parlour
|
|
853
1257
|
sig { returns(String) }
|
854
1258
|
attr_reader :name
|
855
1259
|
|
856
|
-
sig { returns(
|
1260
|
+
sig { returns(Types::TypeLike) }
|
857
1261
|
attr_reader :type
|
858
1262
|
|
859
1263
|
sig { returns(T.nilable(T.any(T::Boolean, Symbol))) }
|
@@ -888,6 +1292,508 @@ module Parlour
|
|
888
1292
|
|
889
1293
|
sig { returns(String) }
|
890
1294
|
def to_prop_call; end
|
1295
|
+
|
1296
|
+
sig { void }
|
1297
|
+
def generalize_from_rbi!; end
|
1298
|
+
end
|
1299
|
+
|
1300
|
+
class TypeAlias < RbiObject
|
1301
|
+
sig do
|
1302
|
+
params(
|
1303
|
+
generator: Generator,
|
1304
|
+
name: String,
|
1305
|
+
type: Types::TypeLike,
|
1306
|
+
block: T.nilable(T.proc.params(x: TypeAlias).void)
|
1307
|
+
).void
|
1308
|
+
end
|
1309
|
+
def initialize(generator, name:, type:, &block); end
|
1310
|
+
|
1311
|
+
sig { returns(Types::TypeLike) }
|
1312
|
+
attr_reader :type
|
1313
|
+
|
1314
|
+
sig { params(other: Object).returns(T::Boolean) }
|
1315
|
+
def ==(other); end
|
1316
|
+
|
1317
|
+
sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
|
1318
|
+
def generate_rbi(indent_level, options); end
|
1319
|
+
|
1320
|
+
sig { override.params(others: T::Array[RbiGenerator::RbiObject]).returns(T::Boolean) }
|
1321
|
+
def mergeable?(others); end
|
1322
|
+
|
1323
|
+
sig { override.params(others: T::Array[RbiGenerator::RbiObject]).void }
|
1324
|
+
def merge_into_self(others); end
|
1325
|
+
|
1326
|
+
sig { override.returns(String) }
|
1327
|
+
def describe; end
|
1328
|
+
|
1329
|
+
sig { override.void }
|
1330
|
+
def generalize_from_rbi!; end
|
1331
|
+
end
|
1332
|
+
end
|
1333
|
+
|
1334
|
+
class RbsGenerator < Generator
|
1335
|
+
sig { params(hash: T.untyped).returns(T.untyped) }
|
1336
|
+
def initialize(**hash); end
|
1337
|
+
|
1338
|
+
sig { returns(RbsGenerator::Namespace) }
|
1339
|
+
attr_reader :root
|
1340
|
+
|
1341
|
+
sig { overridable.returns(String) }
|
1342
|
+
def rbs; end
|
1343
|
+
|
1344
|
+
class Arbitrary < RbsObject
|
1345
|
+
sig { params(generator: Generator, code: String, block: T.nilable(T.proc.params(x: Arbitrary).void)).void }
|
1346
|
+
def initialize(generator, code: '', &block); end
|
1347
|
+
|
1348
|
+
sig { returns(String) }
|
1349
|
+
attr_accessor :code
|
1350
|
+
|
1351
|
+
sig { params(other: Object).returns(T::Boolean) }
|
1352
|
+
def ==(other); end
|
1353
|
+
|
1354
|
+
sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
|
1355
|
+
def generate_rbs(indent_level, options); end
|
1356
|
+
|
1357
|
+
sig { override.params(others: T::Array[RbsGenerator::RbsObject]).returns(T::Boolean) }
|
1358
|
+
def mergeable?(others); end
|
1359
|
+
|
1360
|
+
sig { override.params(others: T::Array[RbsGenerator::RbsObject]).void }
|
1361
|
+
def merge_into_self(others); end
|
1362
|
+
|
1363
|
+
sig { override.returns(String) }
|
1364
|
+
def describe; end
|
1365
|
+
end
|
1366
|
+
|
1367
|
+
class Attribute < RbsGenerator::Method
|
1368
|
+
extend T::Sig
|
1369
|
+
|
1370
|
+
sig do
|
1371
|
+
params(
|
1372
|
+
generator: Generator,
|
1373
|
+
name: String,
|
1374
|
+
kind: Symbol,
|
1375
|
+
type: Types::TypeLike,
|
1376
|
+
block: T.nilable(T.proc.params(x: Attribute).void)
|
1377
|
+
).void
|
1378
|
+
end
|
1379
|
+
def initialize(generator, name, kind, type, &block); end
|
1380
|
+
|
1381
|
+
sig { returns(Symbol) }
|
1382
|
+
attr_reader :kind
|
1383
|
+
|
1384
|
+
sig { returns(Types::TypeLike) }
|
1385
|
+
attr_reader :type
|
1386
|
+
|
1387
|
+
sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
|
1388
|
+
def generate_rbs(indent_level, options); end
|
1389
|
+
|
1390
|
+
sig { override.params(other: Object).returns(T::Boolean) }
|
1391
|
+
def ==(other); end
|
1392
|
+
end
|
1393
|
+
|
1394
|
+
class Block
|
1395
|
+
extend T::Sig
|
1396
|
+
|
1397
|
+
sig { params(type: Types::Proc, required: T::Boolean).void }
|
1398
|
+
def initialize(type, required); end
|
1399
|
+
|
1400
|
+
sig { overridable.params(other: Object).returns(T::Boolean) }
|
1401
|
+
def ==(other); end
|
1402
|
+
|
1403
|
+
sig { returns(Types::Proc) }
|
1404
|
+
attr_reader :type
|
1405
|
+
|
1406
|
+
sig { returns(T::Boolean) }
|
1407
|
+
attr_reader :required
|
1408
|
+
|
1409
|
+
sig { params(options: Options).returns(T::Array[String]) }
|
1410
|
+
def generate_rbs(options); end
|
1411
|
+
end
|
1412
|
+
|
1413
|
+
class ClassNamespace < Namespace
|
1414
|
+
extend T::Sig
|
1415
|
+
|
1416
|
+
sig do
|
1417
|
+
params(
|
1418
|
+
generator: Generator,
|
1419
|
+
name: String,
|
1420
|
+
superclass: T.nilable(Types::TypeLike),
|
1421
|
+
block: T.nilable(T.proc.params(x: ClassNamespace).void)
|
1422
|
+
).void
|
1423
|
+
end
|
1424
|
+
def initialize(generator, name, superclass, &block); end
|
1425
|
+
|
1426
|
+
sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
|
1427
|
+
def generate_rbs(indent_level, options); end
|
1428
|
+
|
1429
|
+
sig { returns(T.nilable(Types::TypeLike)) }
|
1430
|
+
attr_reader :superclass
|
1431
|
+
|
1432
|
+
sig { override.params(others: T::Array[RbsGenerator::RbsObject]).returns(T::Boolean) }
|
1433
|
+
def mergeable?(others); end
|
1434
|
+
|
1435
|
+
sig { override.params(others: T::Array[RbsGenerator::RbsObject]).void }
|
1436
|
+
def merge_into_self(others); end
|
1437
|
+
|
1438
|
+
sig { override.returns(String) }
|
1439
|
+
def describe; end
|
1440
|
+
end
|
1441
|
+
|
1442
|
+
class Constant < RbsObject
|
1443
|
+
sig do
|
1444
|
+
params(
|
1445
|
+
generator: Generator,
|
1446
|
+
name: String,
|
1447
|
+
type: Types::TypeLike,
|
1448
|
+
block: T.nilable(T.proc.params(x: Constant).void)
|
1449
|
+
).void
|
1450
|
+
end
|
1451
|
+
def initialize(generator, name, type:, &block); end
|
1452
|
+
|
1453
|
+
sig { returns(Types::TypeLike) }
|
1454
|
+
attr_reader :type
|
1455
|
+
|
1456
|
+
sig { params(other: Object).returns(T::Boolean) }
|
1457
|
+
def ==(other); end
|
1458
|
+
|
1459
|
+
sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
|
1460
|
+
def generate_rbs(indent_level, options); end
|
1461
|
+
|
1462
|
+
sig { override.params(others: T::Array[RbsGenerator::RbsObject]).returns(T::Boolean) }
|
1463
|
+
def mergeable?(others); end
|
1464
|
+
|
1465
|
+
sig { override.params(others: T::Array[RbsGenerator::RbsObject]).void }
|
1466
|
+
def merge_into_self(others); end
|
1467
|
+
|
1468
|
+
sig { override.returns(String) }
|
1469
|
+
def describe; end
|
1470
|
+
end
|
1471
|
+
|
1472
|
+
class Extend < RbsObject
|
1473
|
+
sig { params(generator: Generator, type: Types::TypeLike, block: T.nilable(T.proc.params(x: Extend).void)).void }
|
1474
|
+
def initialize(generator, type:, &block); end
|
1475
|
+
|
1476
|
+
sig { params(other: Object).returns(T::Boolean) }
|
1477
|
+
def ==(other); end
|
1478
|
+
|
1479
|
+
sig { returns(Types::TypeLike) }
|
1480
|
+
attr_reader :type
|
1481
|
+
|
1482
|
+
sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
|
1483
|
+
def generate_rbs(indent_level, options); end
|
1484
|
+
|
1485
|
+
sig { override.params(others: T::Array[RbsGenerator::RbsObject]).returns(T::Boolean) }
|
1486
|
+
def mergeable?(others); end
|
1487
|
+
|
1488
|
+
sig { override.params(others: T::Array[RbsGenerator::RbsObject]).void }
|
1489
|
+
def merge_into_self(others); end
|
1490
|
+
|
1491
|
+
sig { override.returns(String) }
|
1492
|
+
def describe; end
|
1493
|
+
end
|
1494
|
+
|
1495
|
+
class Include < RbsObject
|
1496
|
+
sig { params(generator: Generator, type: Types::TypeLike, block: T.nilable(T.proc.params(x: Include).void)).void }
|
1497
|
+
def initialize(generator, type:, &block); end
|
1498
|
+
|
1499
|
+
sig { params(other: Object).returns(T::Boolean) }
|
1500
|
+
def ==(other); end
|
1501
|
+
|
1502
|
+
sig { returns(Types::TypeLike) }
|
1503
|
+
attr_reader :type
|
1504
|
+
|
1505
|
+
sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
|
1506
|
+
def generate_rbs(indent_level, options); end
|
1507
|
+
|
1508
|
+
sig { override.params(others: T::Array[RbsGenerator::RbsObject]).returns(T::Boolean) }
|
1509
|
+
def mergeable?(others); end
|
1510
|
+
|
1511
|
+
sig { override.params(others: T::Array[RbsGenerator::RbsObject]).void }
|
1512
|
+
def merge_into_self(others); end
|
1513
|
+
|
1514
|
+
sig { override.returns(String) }
|
1515
|
+
def describe; end
|
1516
|
+
end
|
1517
|
+
|
1518
|
+
class InterfaceNamespace < Namespace
|
1519
|
+
extend T::Sig
|
1520
|
+
|
1521
|
+
sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
|
1522
|
+
def generate_rbs(indent_level, options); end
|
1523
|
+
|
1524
|
+
sig { override.returns(String) }
|
1525
|
+
def describe; end
|
1526
|
+
end
|
1527
|
+
|
1528
|
+
class Method < RbsObject
|
1529
|
+
extend T::Sig
|
1530
|
+
|
1531
|
+
sig do
|
1532
|
+
params(
|
1533
|
+
generator: Generator,
|
1534
|
+
name: String,
|
1535
|
+
signatures: T::Array[MethodSignature],
|
1536
|
+
class_method: T::Boolean,
|
1537
|
+
block: T.nilable(T.proc.params(x: Method).void)
|
1538
|
+
).void
|
1539
|
+
end
|
1540
|
+
def initialize(generator, name, signatures, class_method: false, &block); end
|
1541
|
+
|
1542
|
+
sig { overridable.params(other: Object).returns(T::Boolean) }
|
1543
|
+
def ==(other); end
|
1544
|
+
|
1545
|
+
sig { returns(T::Array[MethodSignature]) }
|
1546
|
+
attr_reader :signatures
|
1547
|
+
|
1548
|
+
sig { returns(T::Boolean) }
|
1549
|
+
attr_reader :class_method
|
1550
|
+
|
1551
|
+
sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
|
1552
|
+
def generate_rbs(indent_level, options); end
|
1553
|
+
|
1554
|
+
sig { override.params(others: T::Array[RbsGenerator::RbsObject]).returns(T::Boolean) }
|
1555
|
+
def mergeable?(others); end
|
1556
|
+
|
1557
|
+
sig { override.params(others: T::Array[RbsGenerator::RbsObject]).void }
|
1558
|
+
def merge_into_self(others); end
|
1559
|
+
|
1560
|
+
sig { override.returns(String) }
|
1561
|
+
def describe; end
|
1562
|
+
end
|
1563
|
+
|
1564
|
+
class MethodSignature
|
1565
|
+
extend T::Sig
|
1566
|
+
|
1567
|
+
sig do
|
1568
|
+
params(
|
1569
|
+
parameters: T::Array[Parameter],
|
1570
|
+
return_type: T.nilable(Types::TypeLike),
|
1571
|
+
block: T.nilable(Block),
|
1572
|
+
type_parameters: T.nilable(T::Array[Symbol])
|
1573
|
+
).void
|
1574
|
+
end
|
1575
|
+
def initialize(parameters, return_type = nil, block: nil, type_parameters: nil); end
|
1576
|
+
|
1577
|
+
sig { overridable.params(other: Object).returns(T::Boolean) }
|
1578
|
+
def ==(other); end
|
1579
|
+
|
1580
|
+
sig { returns(T::Array[Parameter]) }
|
1581
|
+
attr_reader :parameters
|
1582
|
+
|
1583
|
+
sig { returns(T.nilable(Types::TypeLike)) }
|
1584
|
+
attr_reader :return_type
|
1585
|
+
|
1586
|
+
sig { returns(T.nilable(Block)) }
|
1587
|
+
attr_reader :block
|
1588
|
+
|
1589
|
+
sig { returns(T::Array[Symbol]) }
|
1590
|
+
attr_reader :type_parameters
|
1591
|
+
|
1592
|
+
sig { params(options: Options).returns(T::Array[String]) }
|
1593
|
+
def generate_rbs(options); end
|
1594
|
+
end
|
1595
|
+
|
1596
|
+
class ModuleNamespace < Namespace
|
1597
|
+
extend T::Sig
|
1598
|
+
|
1599
|
+
sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
|
1600
|
+
def generate_rbs(indent_level, options); end
|
1601
|
+
|
1602
|
+
sig { override.returns(String) }
|
1603
|
+
def describe; end
|
1604
|
+
end
|
1605
|
+
|
1606
|
+
class Namespace < RbsObject
|
1607
|
+
extend T::Sig
|
1608
|
+
|
1609
|
+
sig { override.overridable.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
|
1610
|
+
def generate_rbs(indent_level, options); end
|
1611
|
+
|
1612
|
+
sig { params(generator: Generator, name: T.nilable(String), block: T.nilable(T.proc.params(x: Namespace).void)).void }
|
1613
|
+
def initialize(generator, name = nil, &block); end
|
1614
|
+
|
1615
|
+
sig { returns(T::Array[RbsObject]) }
|
1616
|
+
attr_reader :children
|
1617
|
+
|
1618
|
+
sig { returns(T::Array[RbsGenerator::Extend]) }
|
1619
|
+
def extends; end
|
1620
|
+
|
1621
|
+
sig { returns(T::Array[RbsGenerator::Include]) }
|
1622
|
+
def includes; end
|
1623
|
+
|
1624
|
+
sig { returns(T::Array[RbsGenerator::TypeAlias]) }
|
1625
|
+
def aliases; end
|
1626
|
+
|
1627
|
+
sig { returns(T::Array[RbsGenerator::Constant]) }
|
1628
|
+
def constants; end
|
1629
|
+
|
1630
|
+
sig { params(object: T.untyped, block: T.proc.params(x: Namespace).void).void }
|
1631
|
+
def path(object, &block); end
|
1632
|
+
|
1633
|
+
sig { params(comment: T.any(String, T::Array[String])).void }
|
1634
|
+
def add_comment_to_next_child(comment); end
|
1635
|
+
|
1636
|
+
sig { params(name: String, superclass: T.nilable(Types::TypeLike), block: T.nilable(T.proc.params(x: ClassNamespace).void)).returns(ClassNamespace) }
|
1637
|
+
def create_class(name, superclass: nil, &block); end
|
1638
|
+
|
1639
|
+
sig { params(name: String, block: T.nilable(T.proc.params(x: Namespace).void)).returns(ModuleNamespace) }
|
1640
|
+
def create_module(name, &block); end
|
1641
|
+
|
1642
|
+
sig { params(name: String, block: T.nilable(T.proc.params(x: Namespace).void)).returns(InterfaceNamespace) }
|
1643
|
+
def create_interface(name, &block); end
|
1644
|
+
|
1645
|
+
sig do
|
1646
|
+
params(
|
1647
|
+
name: String,
|
1648
|
+
signatures: T.nilable(T::Array[MethodSignature]),
|
1649
|
+
class_method: T::Boolean,
|
1650
|
+
block: T.nilable(T.proc.params(x: Method).void)
|
1651
|
+
).returns(Method)
|
1652
|
+
end
|
1653
|
+
def create_method(name, signatures = nil, class_method: false, &block); end
|
1654
|
+
|
1655
|
+
sig do
|
1656
|
+
params(
|
1657
|
+
name: String,
|
1658
|
+
kind: Symbol,
|
1659
|
+
type: Types::TypeLike,
|
1660
|
+
block: T.nilable(T.proc.params(x: Attribute).void)
|
1661
|
+
).returns(Attribute)
|
1662
|
+
end
|
1663
|
+
def create_attribute(name, kind:, type:, &block); end
|
1664
|
+
|
1665
|
+
sig { params(name: String, type: Types::TypeLike, block: T.nilable(T.proc.params(x: Attribute).void)).returns(Attribute) }
|
1666
|
+
def create_attr_reader(name, type:, &block); end
|
1667
|
+
|
1668
|
+
sig { params(name: String, type: Types::TypeLike, block: T.nilable(T.proc.params(x: Attribute).void)).returns(Attribute) }
|
1669
|
+
def create_attr_writer(name, type:, &block); end
|
1670
|
+
|
1671
|
+
sig { params(name: String, type: Types::TypeLike, block: T.nilable(T.proc.params(x: Attribute).void)).returns(Attribute) }
|
1672
|
+
def create_attr_accessor(name, type:, &block); end
|
1673
|
+
|
1674
|
+
sig { params(code: T.untyped, block: T.untyped).returns(T.untyped) }
|
1675
|
+
def create_arbitrary(code:, &block); end
|
1676
|
+
|
1677
|
+
sig { params(type: Types::TypeLike, block: T.nilable(T.proc.params(x: Extend).void)).returns(RbsGenerator::Extend) }
|
1678
|
+
def create_extend(type, &block); end
|
1679
|
+
|
1680
|
+
sig { params(extendables: T::Array[Types::TypeLike]).returns(T::Array[Extend]) }
|
1681
|
+
def create_extends(extendables); end
|
1682
|
+
|
1683
|
+
sig { params(type: Types::TypeLike, block: T.nilable(T.proc.params(x: Include).void)).returns(Include) }
|
1684
|
+
def create_include(type, &block); end
|
1685
|
+
|
1686
|
+
sig { params(includables: T::Array[Types::TypeLike]).returns(T::Array[Include]) }
|
1687
|
+
def create_includes(includables); end
|
1688
|
+
|
1689
|
+
sig { params(name: String, type: Types::TypeLike, block: T.nilable(T.proc.params(x: Constant).void)).returns(Constant) }
|
1690
|
+
def create_constant(name, type:, &block); end
|
1691
|
+
|
1692
|
+
sig { params(name: String, type: Types::TypeLike, block: T.nilable(T.proc.params(x: TypeAlias).void)).returns(TypeAlias) }
|
1693
|
+
def create_type_alias(name, type:, &block); end
|
1694
|
+
|
1695
|
+
sig { override.overridable.params(others: T::Array[RbsGenerator::RbsObject]).returns(T::Boolean) }
|
1696
|
+
def mergeable?(others); end
|
1697
|
+
|
1698
|
+
sig { override.overridable.params(others: T::Array[RbsGenerator::RbsObject]).void }
|
1699
|
+
def merge_into_self(others); end
|
1700
|
+
|
1701
|
+
sig { override.overridable.returns(String) }
|
1702
|
+
def describe; end
|
1703
|
+
|
1704
|
+
sig { overridable.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
|
1705
|
+
def generate_body(indent_level, options); end
|
1706
|
+
|
1707
|
+
sig { params(object: RbsObject).void }
|
1708
|
+
def move_next_comments(object); end
|
1709
|
+
end
|
1710
|
+
|
1711
|
+
class Parameter
|
1712
|
+
extend T::Sig
|
1713
|
+
RBS_KEYWORDS = [
|
1714
|
+
'type', 'interface', 'out', 'in', 'instance'
|
1715
|
+
]
|
1716
|
+
PREFIXES = {
|
1717
|
+
normal: '',
|
1718
|
+
splat: '*',
|
1719
|
+
double_splat: '**',
|
1720
|
+
}.freeze
|
1721
|
+
|
1722
|
+
sig { params(name: String, type: T.nilable(Types::TypeLike), required: T::Boolean).void }
|
1723
|
+
def initialize(name, type: nil, required: true); end
|
1724
|
+
|
1725
|
+
sig { params(other: Object).returns(T::Boolean) }
|
1726
|
+
def ==(other); end
|
1727
|
+
|
1728
|
+
sig { returns(String) }
|
1729
|
+
attr_reader :name
|
1730
|
+
|
1731
|
+
sig { returns(String) }
|
1732
|
+
def name_without_kind; end
|
1733
|
+
|
1734
|
+
sig { returns(Types::TypeLike) }
|
1735
|
+
attr_reader :type
|
1736
|
+
|
1737
|
+
sig { returns(T::Boolean) }
|
1738
|
+
attr_reader :required
|
1739
|
+
|
1740
|
+
sig { returns(Symbol) }
|
1741
|
+
attr_reader :kind
|
1742
|
+
|
1743
|
+
sig { returns(String) }
|
1744
|
+
def to_rbs_param; end
|
1745
|
+
end
|
1746
|
+
|
1747
|
+
class RbsObject < TypedObject
|
1748
|
+
abstract!
|
1749
|
+
|
1750
|
+
sig { params(generator: Generator, name: String).void }
|
1751
|
+
def initialize(generator, name); end
|
1752
|
+
|
1753
|
+
sig { returns(Generator) }
|
1754
|
+
attr_reader :generator
|
1755
|
+
|
1756
|
+
sig { abstract.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
|
1757
|
+
def generate_rbs(indent_level, options); end
|
1758
|
+
|
1759
|
+
sig { abstract.params(others: T::Array[RbsGenerator::RbsObject]).returns(T::Boolean) }
|
1760
|
+
def mergeable?(others); end
|
1761
|
+
|
1762
|
+
sig { abstract.params(others: T::Array[RbsGenerator::RbsObject]).void }
|
1763
|
+
def merge_into_self(others); end
|
1764
|
+
|
1765
|
+
sig { override.overridable.returns(String) }
|
1766
|
+
def describe; end
|
1767
|
+
end
|
1768
|
+
|
1769
|
+
class TypeAlias < RbsObject
|
1770
|
+
sig do
|
1771
|
+
params(
|
1772
|
+
generator: Generator,
|
1773
|
+
name: String,
|
1774
|
+
type: Types::TypeLike,
|
1775
|
+
block: T.nilable(T.proc.params(x: TypeAlias).void)
|
1776
|
+
).void
|
1777
|
+
end
|
1778
|
+
def initialize(generator, name:, type:, &block); end
|
1779
|
+
|
1780
|
+
sig { returns(Types::TypeLike) }
|
1781
|
+
attr_reader :type
|
1782
|
+
|
1783
|
+
sig { params(other: Object).returns(T::Boolean) }
|
1784
|
+
def ==(other); end
|
1785
|
+
|
1786
|
+
sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
|
1787
|
+
def generate_rbs(indent_level, options); end
|
1788
|
+
|
1789
|
+
sig { override.params(others: T::Array[RbsGenerator::RbsObject]).returns(T::Boolean) }
|
1790
|
+
def mergeable?(others); end
|
1791
|
+
|
1792
|
+
sig { override.params(others: T::Array[RbsGenerator::RbsObject]).void }
|
1793
|
+
def merge_into_self(others); end
|
1794
|
+
|
1795
|
+
sig { override.returns(String) }
|
1796
|
+
def describe; end
|
891
1797
|
end
|
892
1798
|
end
|
893
1799
|
end
|