rbs 2.6.0 → 2.7.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +5 -0
- data/CHANGELOG.md +48 -1
- data/Gemfile.lock +10 -9
- data/Rakefile +0 -5
- data/Steepfile +1 -0
- data/core/basic_object.rbs +2 -2
- data/core/fiber.rbs +304 -14
- data/core/float.rbs +2 -0
- data/core/io.rbs +95 -1
- data/core/kernel.rbs +1 -1
- data/core/module.rbs +1 -1
- data/core/regexp.rbs +1 -1
- data/core/string_io.rbs +1 -1
- data/core/warning.rbs +1 -1
- data/ext/rbs_extension/parser.c +36 -10
- data/ext/rbs_extension/ruby_objs.c +4 -2
- data/ext/rbs_extension/ruby_objs.h +2 -2
- data/lib/rbs/ancestor_graph.rb +2 -0
- data/lib/rbs/annotate/annotations.rb +2 -0
- data/lib/rbs/annotate/formatter.rb +4 -2
- data/lib/rbs/annotate/rdoc_annotator.rb +2 -0
- data/lib/rbs/annotate/rdoc_source.rb +2 -0
- data/lib/rbs/annotate.rb +2 -0
- data/lib/rbs/ast/annotation.rb +2 -0
- data/lib/rbs/ast/comment.rb +2 -0
- data/lib/rbs/ast/declarations.rb +2 -0
- data/lib/rbs/ast/members.rb +2 -0
- data/lib/rbs/ast/type_param.rb +3 -1
- data/lib/rbs/buffer.rb +2 -0
- data/lib/rbs/builtin_names.rb +2 -0
- data/lib/rbs/cli.rb +39 -2
- data/lib/rbs/collection/cleaner.rb +2 -0
- data/lib/rbs/collection/config/lockfile_generator.rb +8 -3
- data/lib/rbs/collection/config.rb +2 -0
- data/lib/rbs/collection/installer.rb +2 -0
- data/lib/rbs/collection/sources/base.rb +14 -0
- data/lib/rbs/collection/sources/git.rb +3 -0
- data/lib/rbs/collection/sources/rubygems.rb +3 -0
- data/lib/rbs/collection/sources/stdlib.rb +12 -7
- data/lib/rbs/collection/sources.rb +3 -0
- data/lib/rbs/collection.rb +2 -0
- data/lib/rbs/constant.rb +2 -0
- data/lib/rbs/constant_table.rb +5 -3
- data/lib/rbs/definition.rb +13 -1
- data/lib/rbs/definition_builder/ancestor_builder.rb +2 -0
- data/lib/rbs/definition_builder/method_builder.rb +2 -0
- data/lib/rbs/definition_builder.rb +75 -13
- data/lib/rbs/environment.rb +2 -0
- data/lib/rbs/environment_loader.rb +25 -5
- data/lib/rbs/environment_walker.rb +2 -0
- data/lib/rbs/errors.rb +3 -1
- data/lib/rbs/factory.rb +2 -0
- data/lib/rbs/location_aux.rb +3 -1
- data/lib/rbs/locator.rb +2 -0
- data/lib/rbs/method_type.rb +7 -5
- data/lib/rbs/namespace.rb +9 -5
- data/lib/rbs/parser_aux.rb +2 -0
- data/lib/rbs/parser_compat/lexer_error.rb +2 -0
- data/lib/rbs/parser_compat/located_value.rb +2 -0
- data/lib/rbs/parser_compat/semantics_error.rb +2 -0
- data/lib/rbs/parser_compat/syntax_error.rb +2 -0
- data/lib/rbs/prototype/helpers.rb +13 -8
- data/lib/rbs/prototype/rb.rb +2 -0
- data/lib/rbs/prototype/rbi.rb +11 -6
- data/lib/rbs/prototype/runtime.rb +13 -4
- data/lib/rbs/repository.rb +4 -4
- data/lib/rbs/resolver/constant_resolver.rb +2 -0
- data/lib/rbs/resolver/type_name_resolver.rb +2 -0
- data/lib/rbs/sorter.rb +168 -0
- data/lib/rbs/substitution.rb +2 -0
- data/lib/rbs/test/errors.rb +2 -0
- data/lib/rbs/test/hook.rb +2 -0
- data/lib/rbs/test/observer.rb +2 -0
- data/lib/rbs/test/setup.rb +2 -0
- data/lib/rbs/test/setup_helper.rb +2 -0
- data/lib/rbs/test/spy.rb +2 -0
- data/lib/rbs/test/tester.rb +2 -0
- data/lib/rbs/test/type_check.rb +2 -0
- data/lib/rbs/test.rb +2 -0
- data/lib/rbs/type_alias_dependency.rb +2 -0
- data/lib/rbs/type_alias_regularity.rb +2 -0
- data/lib/rbs/type_name.rb +2 -0
- data/lib/rbs/type_name_resolver.rb +4 -2
- data/lib/rbs/types.rb +68 -18
- data/lib/rbs/validator.rb +2 -0
- data/lib/rbs/variance_calculator.rb +2 -0
- data/lib/rbs/vendorer.rb +2 -0
- data/lib/rbs/version.rb +3 -1
- data/lib/rbs/writer.rb +3 -1
- data/lib/rbs.rb +4 -2
- data/lib/rdoc/discover.rb +20 -0
- data/lib/rdoc_plugin/parser.rb +163 -0
- data/schema/methodType.json +7 -1
- data/schema/types.json +13 -1
- data/sig/ancestor_builder.rbs +66 -7
- data/sig/annotation.rbs +7 -6
- data/sig/builtin_names.rbs +2 -0
- data/sig/cli.rbs +8 -0
- data/sig/collection/config.rbs +13 -4
- data/sig/collection/installer.rbs +2 -0
- data/sig/collection/sources.rbs +23 -4
- data/sig/definition.rbs +8 -0
- data/sig/definition_builder.rbs +64 -7
- data/sig/environment.rbs +4 -0
- data/sig/environment_loader.rbs +4 -2
- data/sig/location.rbs +8 -4
- data/sig/manifest.yaml +1 -0
- data/sig/members.rbs +1 -1
- data/sig/method_builder.rbs +10 -0
- data/sig/namespace.rbs +54 -31
- data/sig/prototype/rb.rbs +4 -0
- data/sig/rbs.rbs +8 -6
- data/sig/rdoc/rbs.rbs +63 -0
- data/sig/{polyfill.rbs → shims.rbs} +1 -31
- data/sig/sorter.rbs +23 -0
- data/sig/types.rbs +14 -2
- data/sig/vendorer.rbs +32 -25
- data/stdlib/bigdecimal/0/big_decimal.rbs +250 -0
- data/stdlib/erb/0/erb.rbs +107 -0
- data/stdlib/logger/0/logger.rbs +2 -2
- data/stdlib/rdoc/0/rdoc.rbs +758 -0
- data/steep/Gemfile.lock +8 -8
- metadata +12 -6
- data/stdlib/fiber/0/fiber.rbs +0 -99
@@ -0,0 +1,758 @@
|
|
1
|
+
# <!-- rdoc-file=lib/rdoc/rubygems_hook.rb -->
|
2
|
+
# Gem::RDoc provides methods to generate RDoc and ri data for installed gems
|
3
|
+
# upon gem installation.
|
4
|
+
#
|
5
|
+
# This file is automatically required by RubyGems 1.9 and newer.
|
6
|
+
#
|
7
|
+
# <!-- rdoc-file=lib/rdoc.rb -->
|
8
|
+
# RDoc produces documentation for Ruby source files by parsing the source and
|
9
|
+
# extracting the definition for classes, modules, methods, includes and
|
10
|
+
# requires. It associates these with optional documentation contained in an
|
11
|
+
# immediately preceding comment block then renders the result using an output
|
12
|
+
# formatter.
|
13
|
+
#
|
14
|
+
# For a simple introduction to writing or generating documentation using RDoc
|
15
|
+
# see the README.
|
16
|
+
#
|
17
|
+
# ## Roadmap
|
18
|
+
#
|
19
|
+
# If you think you found a bug in RDoc see CONTRIBUTING@Bugs
|
20
|
+
#
|
21
|
+
# If you want to use RDoc to create documentation for your Ruby source files,
|
22
|
+
# see RDoc::Markup and refer to `rdoc --help` for command line usage.
|
23
|
+
#
|
24
|
+
# If you want to set the default markup format see
|
25
|
+
# RDoc::Markup@Supported+Formats
|
26
|
+
#
|
27
|
+
# If you want to store rdoc configuration in your gem (such as the default
|
28
|
+
# markup format) see RDoc::Options@Saved+Options
|
29
|
+
#
|
30
|
+
# If you want to write documentation for Ruby files see RDoc::Parser::Ruby
|
31
|
+
#
|
32
|
+
# If you want to write documentation for extensions written in C see
|
33
|
+
# RDoc::Parser::C
|
34
|
+
#
|
35
|
+
# If you want to generate documentation using `rake` see RDoc::Task.
|
36
|
+
#
|
37
|
+
# If you want to drive RDoc programmatically, see RDoc::RDoc.
|
38
|
+
#
|
39
|
+
# If you want to use the library to format text blocks into HTML or other
|
40
|
+
# formats, look at RDoc::Markup.
|
41
|
+
#
|
42
|
+
# If you want to make an RDoc plugin such as a generator or directive handler
|
43
|
+
# see RDoc::RDoc.
|
44
|
+
#
|
45
|
+
# If you want to write your own output generator see RDoc::Generator.
|
46
|
+
#
|
47
|
+
# If you want an overview of how RDoc works see CONTRIBUTING
|
48
|
+
#
|
49
|
+
# ## Credits
|
50
|
+
#
|
51
|
+
# RDoc is currently being maintained by Eric Hodel <drbrain@segment7.net>.
|
52
|
+
#
|
53
|
+
# Dave Thomas <dave@pragmaticprogrammer.com> is the original author of RDoc.
|
54
|
+
#
|
55
|
+
# * The Ruby parser in rdoc/parse.rb is based heavily on the outstanding work
|
56
|
+
# of Keiju ISHITSUKA of Nippon Rational Inc, who produced the Ruby parser
|
57
|
+
# for irb and the rtags package.
|
58
|
+
#
|
59
|
+
module RDoc
|
60
|
+
# <!-- rdoc-file=lib/rdoc/parser.rb -->
|
61
|
+
# A parser is simple a class that subclasses RDoc::Parser and implements #scan
|
62
|
+
# to fill in an RDoc::TopLevel with parsed data.
|
63
|
+
#
|
64
|
+
# The initialize method takes an RDoc::TopLevel to fill with parsed content, the
|
65
|
+
# name of the file to be parsed, the content of the file, an RDoc::Options
|
66
|
+
# object and an RDoc::Stats object to inform the user of parsed items. The scan
|
67
|
+
# method is then called to parse the file and must return the RDoc::TopLevel
|
68
|
+
# object. By calling super these items will be set for you.
|
69
|
+
#
|
70
|
+
# In order to be used by RDoc the parser needs to register the file extensions
|
71
|
+
# it can parse. Use ::parse_files_matching to register extensions.
|
72
|
+
#
|
73
|
+
# require 'rdoc'
|
74
|
+
#
|
75
|
+
# class RDoc::Parser::Xyz < RDoc::Parser
|
76
|
+
# parse_files_matching /\.xyz$/
|
77
|
+
#
|
78
|
+
# def initialize top_level, file_name, content, options, stats
|
79
|
+
# super
|
80
|
+
#
|
81
|
+
# # extra initialization if needed
|
82
|
+
# end
|
83
|
+
#
|
84
|
+
# def scan
|
85
|
+
# # parse file and fill in @top_level
|
86
|
+
# end
|
87
|
+
# end
|
88
|
+
#
|
89
|
+
class Parser
|
90
|
+
# <!--
|
91
|
+
# rdoc-file=lib/rdoc/parser.rb
|
92
|
+
# - parse_files_matching(regexp)
|
93
|
+
# -->
|
94
|
+
# Record which file types this parser can understand.
|
95
|
+
#
|
96
|
+
# It is ok to call this multiple times.
|
97
|
+
#
|
98
|
+
def self?.parse_files_matching: (Regexp path) -> void
|
99
|
+
|
100
|
+
# <!--
|
101
|
+
# rdoc-file=lib/rdoc/parser.rb
|
102
|
+
# - new(top_level, file_name, content, options, stats)
|
103
|
+
# -->
|
104
|
+
# Creates a new Parser storing `top_level`, `file_name`, `content`, `options`
|
105
|
+
# and `stats` in instance variables. In +@preprocess+ an
|
106
|
+
# RDoc::Markup::PreProcess object is created which allows processing of
|
107
|
+
# directives.
|
108
|
+
#
|
109
|
+
def initialize: (RDoc::TopLevel top_level, String filename, String content, Hash[untyped, untyped] options, RDoc::Stats stats) -> void
|
110
|
+
|
111
|
+
def scan: () -> RDoc::TopLevel
|
112
|
+
end
|
113
|
+
|
114
|
+
# <!-- rdoc-file=lib/rdoc/code_object.rb -->
|
115
|
+
# Base class for the RDoc code tree.
|
116
|
+
#
|
117
|
+
# We contain the common stuff for contexts (which are containers) and other
|
118
|
+
# elements (methods, attributes and so on)
|
119
|
+
#
|
120
|
+
# Here's the tree of the CodeObject subclasses:
|
121
|
+
#
|
122
|
+
# * RDoc::Context
|
123
|
+
# * RDoc::TopLevel
|
124
|
+
# * RDoc::ClassModule
|
125
|
+
# * RDoc::AnonClass (never used so far)
|
126
|
+
# * RDoc::NormalClass
|
127
|
+
# * RDoc::NormalModule
|
128
|
+
# * RDoc::SingleClass
|
129
|
+
#
|
130
|
+
#
|
131
|
+
# * RDoc::MethodAttr
|
132
|
+
# * RDoc::Attr
|
133
|
+
# * RDoc::AnyMethod
|
134
|
+
# * RDoc::GhostMethod
|
135
|
+
# * RDoc::MetaMethod
|
136
|
+
#
|
137
|
+
#
|
138
|
+
# * RDoc::Alias
|
139
|
+
# * RDoc::Constant
|
140
|
+
# * RDoc::Mixin
|
141
|
+
# * RDoc::Require
|
142
|
+
# * RDoc::Include
|
143
|
+
#
|
144
|
+
class CodeObject
|
145
|
+
# <!-- rdoc-file=lib/rdoc/code_object.rb -->
|
146
|
+
# Our comment
|
147
|
+
#
|
148
|
+
attr_reader comment: RDoc::Comment
|
149
|
+
|
150
|
+
# <!--
|
151
|
+
# rdoc-file=lib/rdoc/code_object.rb
|
152
|
+
# - new()
|
153
|
+
# -->
|
154
|
+
# Creates a new CodeObject that will document itself and its children
|
155
|
+
#
|
156
|
+
def initialize: () -> void
|
157
|
+
|
158
|
+
# <!--
|
159
|
+
# rdoc-file=lib/rdoc/code_object.rb
|
160
|
+
# - comment=(comment)
|
161
|
+
# -->
|
162
|
+
# Replaces our comment with `comment`, unless it is empty.
|
163
|
+
#
|
164
|
+
def comment=: (RDoc::Comment | String) -> RDoc::Comment
|
165
|
+
end
|
166
|
+
|
167
|
+
# <!-- rdoc-file=lib/rdoc/context.rb -->
|
168
|
+
# A Context is something that can hold modules, classes, methods, attributes,
|
169
|
+
# aliases, requires, and includes. Classes, modules, and files are all Contexts.
|
170
|
+
#
|
171
|
+
class Context < CodeObject
|
172
|
+
include Comparable
|
173
|
+
|
174
|
+
# <!-- rdoc-file=lib/rdoc/context.rb -->
|
175
|
+
# Types of methods
|
176
|
+
#
|
177
|
+
TYPES: ::Array["class" | "instance"]
|
178
|
+
|
179
|
+
TOMDOC_TITLES: ::Array[nil | "Public" | "Internal" | "Deprecated"]
|
180
|
+
|
181
|
+
type class_types = singleton(RDoc::NormalClass) | singleton(RDoc::SingleClass)
|
182
|
+
|
183
|
+
# <!--
|
184
|
+
# rdoc-file=lib/rdoc/context.rb
|
185
|
+
# - new()
|
186
|
+
# -->
|
187
|
+
# Creates an unnamed empty context with public current visibility
|
188
|
+
#
|
189
|
+
def initialize: () -> void
|
190
|
+
|
191
|
+
# <!--
|
192
|
+
# rdoc-file=lib/rdoc/context.rb
|
193
|
+
# - add_alias(an_alias)
|
194
|
+
# -->
|
195
|
+
# Adds `an_alias` that is automatically resolved
|
196
|
+
#
|
197
|
+
def add_alias: (RDoc::Alias an_alias) -> RDoc::Alias
|
198
|
+
|
199
|
+
# <!--
|
200
|
+
# rdoc-file=lib/rdoc/context.rb
|
201
|
+
# - add_attribute(attribute)
|
202
|
+
# -->
|
203
|
+
# Adds `attribute` if not already there. If it is (as method(s) or attribute),
|
204
|
+
# updates the comment if it was empty.
|
205
|
+
#
|
206
|
+
# The attribute is registered only if it defines a new method. For instance,
|
207
|
+
# `attr_reader :foo` will not be registered if method `foo` exists, but
|
208
|
+
# `attr_accessor :foo` will be registered if method `foo` exists, but `foo=`
|
209
|
+
# does not.
|
210
|
+
#
|
211
|
+
def add_attribute: (RDoc::Attr attribute) -> RDoc::Attr
|
212
|
+
|
213
|
+
# <!--
|
214
|
+
# rdoc-file=lib/rdoc/context.rb
|
215
|
+
# - add_class(class_type, given_name, superclass = '::Object')
|
216
|
+
# -->
|
217
|
+
# Adds a class named `given_name` with `superclass`.
|
218
|
+
#
|
219
|
+
# Both `given_name` and `superclass` may contain '::', and are interpreted
|
220
|
+
# relative to the `self` context. This allows handling correctly examples like
|
221
|
+
# these:
|
222
|
+
# class RDoc::Gauntlet < Gauntlet
|
223
|
+
# module Mod
|
224
|
+
# class Object # implies < ::Object
|
225
|
+
# class SubObject < Object # this is _not_ ::Object
|
226
|
+
#
|
227
|
+
# Given `class Container::Item` RDoc assumes `Container` is a module unless it
|
228
|
+
# later sees `class Container`. `add_class` automatically upgrades `given_name`
|
229
|
+
# to a class in this case.
|
230
|
+
#
|
231
|
+
def add_class: (class_types class_type, ::String given_name, ?::String superclass) -> (RDoc::NormalClass | RDoc::SingleClass)
|
232
|
+
|
233
|
+
# <!--
|
234
|
+
# rdoc-file=lib/rdoc/context.rb
|
235
|
+
# - add_constant(constant)
|
236
|
+
# -->
|
237
|
+
# Adds `constant` if not already there. If it is, updates the comment, value
|
238
|
+
# and/or is_alias_for of the known constant if they were empty/nil.
|
239
|
+
#
|
240
|
+
def add_constant: (RDoc::Constant constant) -> RDoc::Constant
|
241
|
+
|
242
|
+
# <!--
|
243
|
+
# rdoc-file=lib/rdoc/context.rb
|
244
|
+
# - add_include(include)
|
245
|
+
# -->
|
246
|
+
# Adds included module `include` which should be an RDoc::Include
|
247
|
+
#
|
248
|
+
def add_include: (RDoc::Include `include`) -> RDoc::Include
|
249
|
+
|
250
|
+
# <!--
|
251
|
+
# rdoc-file=lib/rdoc/context.rb
|
252
|
+
# - add_extend(ext)
|
253
|
+
# -->
|
254
|
+
# Adds extension module `ext` which should be an RDoc::Extend
|
255
|
+
#
|
256
|
+
def add_extend: (RDoc::Extend ext) -> RDoc::Extend
|
257
|
+
|
258
|
+
# <!--
|
259
|
+
# rdoc-file=lib/rdoc/context.rb
|
260
|
+
# - add_method(method)
|
261
|
+
# -->
|
262
|
+
# Adds `method` if not already there. If it is (as method or attribute), updates
|
263
|
+
# the comment if it was empty.
|
264
|
+
#
|
265
|
+
def add_method: (RDoc::AnyMethod method) -> RDoc::AnyMethod
|
266
|
+
|
267
|
+
# <!--
|
268
|
+
# rdoc-file=lib/rdoc/context.rb
|
269
|
+
# - add_module(class_type, name)
|
270
|
+
# -->
|
271
|
+
# Adds a module named `name`. If RDoc already knows `name` is a class then that
|
272
|
+
# class is returned instead. See also #add_class.
|
273
|
+
#
|
274
|
+
def add_module: (singleton(RDoc::NormalModule) class_type, String name) -> RDoc::NormalModule
|
275
|
+
|
276
|
+
# <!--
|
277
|
+
# rdoc-file=lib/rdoc/context.rb
|
278
|
+
# - find_module_named(name)
|
279
|
+
# -->
|
280
|
+
# Find a module with `name` using ruby's scoping rules
|
281
|
+
#
|
282
|
+
def find_module_named: (untyped name) -> (untyped | self)
|
283
|
+
|
284
|
+
# <!--
|
285
|
+
# rdoc-file=lib/rdoc/context.rb
|
286
|
+
# - full_name()
|
287
|
+
# -->
|
288
|
+
# The full name for this context. This method is overridden by subclasses.
|
289
|
+
#
|
290
|
+
def full_name: () -> "(unknown)"
|
291
|
+
|
292
|
+
def to_s: () -> ::String
|
293
|
+
|
294
|
+
# <!--
|
295
|
+
# rdoc-file=lib/rdoc/context.rb
|
296
|
+
# - top_level()
|
297
|
+
# -->
|
298
|
+
# Return the TopLevel that owns us
|
299
|
+
#
|
300
|
+
def top_level: () -> RDoc::TopLevel
|
301
|
+
end
|
302
|
+
|
303
|
+
# <!-- rdoc-file=lib/rdoc/top_level.rb -->
|
304
|
+
# A TopLevel context is a representation of the contents of a single file
|
305
|
+
#
|
306
|
+
class TopLevel < Context
|
307
|
+
MARSHAL_VERSION: 0
|
308
|
+
|
309
|
+
# <!--
|
310
|
+
# rdoc-file=lib/rdoc/top_level.rb
|
311
|
+
# - new(absolute_name, relative_name = absolute_name)
|
312
|
+
# -->
|
313
|
+
# Creates a new TopLevel for the file at `absolute_name`. If documentation is
|
314
|
+
# being generated outside the source dir `relative_name` is relative to the
|
315
|
+
# source directory.
|
316
|
+
#
|
317
|
+
def initialize: (String absolute_name, ?String relative_name) -> void
|
318
|
+
|
319
|
+
# <!--
|
320
|
+
# rdoc-file=lib/rdoc/top_level.rb
|
321
|
+
# - ==(other)
|
322
|
+
# -->
|
323
|
+
# An RDoc::TopLevel is equal to another with the same relative_name
|
324
|
+
#
|
325
|
+
def ==: (untyped other) -> bool
|
326
|
+
|
327
|
+
# <!--
|
328
|
+
# rdoc-file=lib/rdoc/top_level.rb
|
329
|
+
# - eql?(other)
|
330
|
+
# -->
|
331
|
+
#
|
332
|
+
alias eql? ==
|
333
|
+
|
334
|
+
# <!--
|
335
|
+
# rdoc-file=lib/rdoc/top_level.rb
|
336
|
+
# - add_alias(an_alias)
|
337
|
+
# -->
|
338
|
+
# Adds `an_alias` to `Object` instead of `self`.
|
339
|
+
#
|
340
|
+
def add_alias: (RDoc::Alias an_alias) -> RDoc::Alias
|
341
|
+
|
342
|
+
# <!--
|
343
|
+
# rdoc-file=lib/rdoc/top_level.rb
|
344
|
+
# - add_constant(constant)
|
345
|
+
# -->
|
346
|
+
# Adds `constant` to `Object` instead of `self`.
|
347
|
+
#
|
348
|
+
def add_constant: (RDoc::Constant constant) -> RDoc::Constant
|
349
|
+
|
350
|
+
# <!--
|
351
|
+
# rdoc-file=lib/rdoc/top_level.rb
|
352
|
+
# - add_include(include)
|
353
|
+
# -->
|
354
|
+
# Adds `include` to `Object` instead of `self`.
|
355
|
+
#
|
356
|
+
def add_include: (RDoc::Include `include`) -> RDoc::Include
|
357
|
+
|
358
|
+
# <!--
|
359
|
+
# rdoc-file=lib/rdoc/top_level.rb
|
360
|
+
# - add_method(method)
|
361
|
+
# -->
|
362
|
+
# Adds `method` to `Object` instead of `self`.
|
363
|
+
#
|
364
|
+
def add_method: (RDoc::AnyMethod method) -> RDoc::AnyMethod
|
365
|
+
|
366
|
+
# <!--
|
367
|
+
# rdoc-file=lib/rdoc/top_level.rb
|
368
|
+
# - find_class_or_module(name)
|
369
|
+
# -->
|
370
|
+
# See RDoc::TopLevel::find_class_or_module
|
371
|
+
#
|
372
|
+
def find_class_or_module: (::String name) -> RDoc::Context
|
373
|
+
|
374
|
+
# <!--
|
375
|
+
# rdoc-file=lib/rdoc/top_level.rb
|
376
|
+
# - find_module_named(name)
|
377
|
+
# -->
|
378
|
+
# Finds a module or class with `name`
|
379
|
+
#
|
380
|
+
def find_module_named: (String name) -> RDoc::Context
|
381
|
+
|
382
|
+
# <!--
|
383
|
+
# rdoc-file=lib/rdoc/top_level.rb
|
384
|
+
# - full_name()
|
385
|
+
# -->
|
386
|
+
# Returns the relative name of this file
|
387
|
+
#
|
388
|
+
def full_name: () -> String
|
389
|
+
|
390
|
+
def to_s: () -> ::String
|
391
|
+
end
|
392
|
+
|
393
|
+
# <!-- rdoc-file=lib/rdoc/token_stream.rb -->
|
394
|
+
# A TokenStream is a list of tokens, gathered during the parse of some entity
|
395
|
+
# (say a method). Entities populate these streams by being registered with the
|
396
|
+
# lexer. Any class can collect tokens by including TokenStream. From the
|
397
|
+
# outside, you use such an object by calling the start_collecting_tokens method,
|
398
|
+
# followed by calls to add_token and pop_token.
|
399
|
+
#
|
400
|
+
module TokenStream
|
401
|
+
# <!--
|
402
|
+
# rdoc-file=lib/rdoc/token_stream.rb
|
403
|
+
# - add_token(token)
|
404
|
+
# -->
|
405
|
+
# Adds one `token` to the collected tokens
|
406
|
+
#
|
407
|
+
def add_token: (Hash[untyped, untyped] token) -> void
|
408
|
+
|
409
|
+
# <!--
|
410
|
+
# rdoc-file=lib/rdoc/token_stream.rb
|
411
|
+
# - collect_tokens()
|
412
|
+
# -->
|
413
|
+
# Starts collecting tokens
|
414
|
+
#
|
415
|
+
def collect_tokens: () -> void
|
416
|
+
|
417
|
+
# <!--
|
418
|
+
# rdoc-file=lib/rdoc/token_stream.rb
|
419
|
+
# - start_collecting_tokens()
|
420
|
+
# -->
|
421
|
+
#
|
422
|
+
alias start_collecting_tokens collect_tokens
|
423
|
+
end
|
424
|
+
|
425
|
+
# <!-- rdoc-file=lib/rdoc/comment.rb -->
|
426
|
+
# A comment holds the text comment for a RDoc::CodeObject and provides a unified
|
427
|
+
# way of cleaning it up and parsing it into an RDoc::Markup::Document.
|
428
|
+
#
|
429
|
+
# Each comment may have a different markup format set by #format=. By default
|
430
|
+
# 'rdoc' is used. The :markup: directive tells RDoc which format to use.
|
431
|
+
#
|
432
|
+
# See RDoc::Markup@Other+directives for instructions on adding an alternate
|
433
|
+
# format.
|
434
|
+
#
|
435
|
+
class Comment
|
436
|
+
# <!-- rdoc-file=lib/rdoc/comment.rb -->
|
437
|
+
# The format of this comment. Defaults to RDoc::Markup
|
438
|
+
#
|
439
|
+
attr_reader format: String
|
440
|
+
|
441
|
+
# <!-- rdoc-file=lib/rdoc/comment.rb -->
|
442
|
+
# The RDoc::TopLevel this comment was found in
|
443
|
+
#
|
444
|
+
attr_accessor location: String
|
445
|
+
|
446
|
+
# <!--
|
447
|
+
# rdoc-file=lib/rdoc/comment.rb
|
448
|
+
# - new(text = nil, location = nil, language = nil)
|
449
|
+
# -->
|
450
|
+
# Creates a new comment with `text` that is found in the RDoc::TopLevel
|
451
|
+
# `location`.
|
452
|
+
#
|
453
|
+
def initialize: (?String? text, ?RDoc::Context? location, ?String? language) -> void
|
454
|
+
|
455
|
+
# <!--
|
456
|
+
# rdoc-file=lib/rdoc/comment.rb
|
457
|
+
# - format=(format)
|
458
|
+
# -->
|
459
|
+
# Sets the format of this comment and resets any parsed document
|
460
|
+
#
|
461
|
+
def format=: (String format) -> void
|
462
|
+
end
|
463
|
+
|
464
|
+
# <!-- rdoc-file=lib/rdoc/class_module.rb -->
|
465
|
+
# ClassModule is the base class for objects representing either a class or a
|
466
|
+
# module.
|
467
|
+
#
|
468
|
+
class ClassModule < Context
|
469
|
+
# <!--
|
470
|
+
# rdoc-file=lib/rdoc/class_module.rb
|
471
|
+
# - new(name, superclass = nil)
|
472
|
+
# -->
|
473
|
+
# Creates a new ClassModule with `name` with optional `superclass`
|
474
|
+
#
|
475
|
+
# This is a constructor for subclasses, and must never be called directly.
|
476
|
+
#
|
477
|
+
def initialize: (String name, ?String superclass) -> void
|
478
|
+
|
479
|
+
# <!--
|
480
|
+
# rdoc-file=lib/rdoc/class_module.rb
|
481
|
+
# - add_comment(comment, location)
|
482
|
+
# -->
|
483
|
+
# Adds `comment` to this ClassModule's list of comments at `location`. This
|
484
|
+
# method is preferred over #comment= since it allows ri data to be updated
|
485
|
+
# across multiple runs.
|
486
|
+
#
|
487
|
+
def add_comment: (RDoc::Comment comment, RDoc::Context location) -> void
|
488
|
+
end
|
489
|
+
|
490
|
+
# <!-- rdoc-file=lib/rdoc/normal_class.rb -->
|
491
|
+
# A normal class, neither singleton nor anonymous
|
492
|
+
#
|
493
|
+
class NormalClass < ClassModule
|
494
|
+
def initialize: (String name, ?String superclass) -> void
|
495
|
+
end
|
496
|
+
|
497
|
+
# <!-- rdoc-file=lib/rdoc/single_class.rb -->
|
498
|
+
# A singleton class
|
499
|
+
#
|
500
|
+
class SingleClass < ClassModule
|
501
|
+
def initialize: (String name, ?String superclass) -> void
|
502
|
+
end
|
503
|
+
|
504
|
+
# <!-- rdoc-file=lib/rdoc/normal_module.rb -->
|
505
|
+
# A normal module, like NormalClass
|
506
|
+
#
|
507
|
+
class NormalModule < ClassModule
|
508
|
+
end
|
509
|
+
|
510
|
+
# <!-- rdoc-file=lib/rdoc/method_attr.rb -->
|
511
|
+
# Abstract class representing either a method or an attribute.
|
512
|
+
#
|
513
|
+
class MethodAttr < CodeObject
|
514
|
+
include Comparable
|
515
|
+
|
516
|
+
# <!-- rdoc-file=lib/rdoc/method_attr.rb -->
|
517
|
+
# The method/attribute we're aliasing
|
518
|
+
#
|
519
|
+
attr_reader is_alias_for: MethodAttr?
|
520
|
+
|
521
|
+
# <!-- rdoc-file=lib/rdoc/method_attr.rb -->
|
522
|
+
# The call_seq or the param_seq with method name, if there is no call_seq.
|
523
|
+
#
|
524
|
+
attr_reader arglists: String
|
525
|
+
|
526
|
+
# <!-- rdoc-file=lib/rdoc/method_attr.rb -->
|
527
|
+
# Name of this method/attribute.
|
528
|
+
#
|
529
|
+
attr_accessor name: String
|
530
|
+
|
531
|
+
# <!-- rdoc-file=lib/rdoc/method_attr.rb -->
|
532
|
+
# public, protected, private
|
533
|
+
#
|
534
|
+
attr_accessor visibility: untyped
|
535
|
+
|
536
|
+
# <!-- rdoc-file=lib/rdoc/method_attr.rb -->
|
537
|
+
# Is this a singleton method/attribute?
|
538
|
+
#
|
539
|
+
attr_accessor singleton: bool
|
540
|
+
|
541
|
+
# <!-- rdoc-file=lib/rdoc/method_attr.rb -->
|
542
|
+
# Source file token stream
|
543
|
+
#
|
544
|
+
attr_reader text: String
|
545
|
+
|
546
|
+
# <!-- rdoc-file=lib/rdoc/method_attr.rb -->
|
547
|
+
# Different ways to call this method
|
548
|
+
#
|
549
|
+
attr_accessor call_seq: String
|
550
|
+
|
551
|
+
# <!--
|
552
|
+
# rdoc-file=lib/rdoc/method_attr.rb
|
553
|
+
# - new(text, name)
|
554
|
+
# -->
|
555
|
+
# Creates a new MethodAttr from token stream `text` and method or attribute name
|
556
|
+
# `name`.
|
557
|
+
#
|
558
|
+
# Usually this is called by super from a subclass.
|
559
|
+
#
|
560
|
+
def initialize: (String text, String name) -> void
|
561
|
+
|
562
|
+
# <!--
|
563
|
+
# rdoc-file=lib/rdoc/method_attr.rb
|
564
|
+
# - pretty_name()
|
565
|
+
# -->
|
566
|
+
# Method/attribute name with class/instance indicator
|
567
|
+
#
|
568
|
+
def pretty_name: () -> ::String
|
569
|
+
|
570
|
+
# <!--
|
571
|
+
# rdoc-file=lib/rdoc/method_attr.rb
|
572
|
+
# - type()
|
573
|
+
# -->
|
574
|
+
# Type of method/attribute (class or instance)
|
575
|
+
#
|
576
|
+
def type: () -> ("class" | "instance")
|
577
|
+
|
578
|
+
# <!--
|
579
|
+
# rdoc-file=lib/rdoc/method_attr.rb
|
580
|
+
# - path()
|
581
|
+
# -->
|
582
|
+
# Path to this method for use with HTML generator output.
|
583
|
+
#
|
584
|
+
def path: () -> ::String
|
585
|
+
|
586
|
+
def to_s: () -> ::String
|
587
|
+
end
|
588
|
+
|
589
|
+
# <!-- rdoc-file=lib/rdoc/any_method.rb -->
|
590
|
+
# AnyMethod is the base class for objects representing methods
|
591
|
+
#
|
592
|
+
class AnyMethod < MethodAttr
|
593
|
+
include TokenStream
|
594
|
+
|
595
|
+
# <!--
|
596
|
+
# rdoc-file=lib/rdoc/any_method.rb
|
597
|
+
# - call_seq()
|
598
|
+
# -->
|
599
|
+
# Different ways to call this method
|
600
|
+
# ----
|
601
|
+
# <!--
|
602
|
+
# rdoc-file=lib/rdoc/any_method.rb
|
603
|
+
# - call_seq=(call_seq)
|
604
|
+
# -->
|
605
|
+
# Sets the different ways you can call this method. If an empty `call_seq` is
|
606
|
+
# given nil is assumed.
|
607
|
+
#
|
608
|
+
# See also #param_seq
|
609
|
+
#
|
610
|
+
attr_accessor call_seq: ::String
|
611
|
+
|
612
|
+
# <!-- rdoc-file=lib/rdoc/any_method.rb -->
|
613
|
+
# Parameters for this method
|
614
|
+
#
|
615
|
+
attr_accessor params: ::String
|
616
|
+
|
617
|
+
attr_accessor line: Integer
|
618
|
+
|
619
|
+
# <!--
|
620
|
+
# rdoc-file=lib/rdoc/any_method.rb
|
621
|
+
# - arglists()
|
622
|
+
# -->
|
623
|
+
# The call_seq or the param_seq with method name, if there is no call_seq.
|
624
|
+
#
|
625
|
+
# Use this for displaying a method's argument lists.
|
626
|
+
#
|
627
|
+
def arglists: () -> String?
|
628
|
+
|
629
|
+
def callseq: () -> String?
|
630
|
+
|
631
|
+
# <!--
|
632
|
+
# rdoc-file=lib/rdoc/any_method.rb
|
633
|
+
# - new(text, name)
|
634
|
+
# -->
|
635
|
+
# Creates a new AnyMethod with a token stream `text` and `name`
|
636
|
+
#
|
637
|
+
def initialize: (String? text, String name) -> void
|
638
|
+
end
|
639
|
+
|
640
|
+
# <!-- rdoc-file=lib/rdoc/attr.rb -->
|
641
|
+
# An attribute created by #attr, #attr_reader, #attr_writer or #attr_accessor
|
642
|
+
#
|
643
|
+
class Attr < MethodAttr
|
644
|
+
# <!-- rdoc-file=lib/rdoc/attr.rb -->
|
645
|
+
# Is the attribute readable ('R'), writable ('W') or both ('RW')?
|
646
|
+
#
|
647
|
+
attr_accessor rw: "RW" | "R" | "W"
|
648
|
+
|
649
|
+
# <!--
|
650
|
+
# rdoc-file=lib/rdoc/attr.rb
|
651
|
+
# - new(text, name, rw, comment, singleton = false)
|
652
|
+
# -->
|
653
|
+
# Creates a new Attr with body `text`, `name`, read/write status `rw` and
|
654
|
+
# `comment`. `singleton` marks this as a class attribute.
|
655
|
+
#
|
656
|
+
def initialize: (String? text, String name, String rw, RDoc::Comment? comment, ?bool `singleton`) -> void
|
657
|
+
end
|
658
|
+
|
659
|
+
# <!-- rdoc-file=lib/rdoc/constant.rb -->
|
660
|
+
# A constant
|
661
|
+
#
|
662
|
+
class Constant < CodeObject
|
663
|
+
# <!-- rdoc-file=lib/rdoc/constant.rb -->
|
664
|
+
# Sets the module or class this is constant is an alias for.
|
665
|
+
#
|
666
|
+
attr_writer is_alias_for: String
|
667
|
+
|
668
|
+
# <!-- rdoc-file=lib/rdoc/constant.rb -->
|
669
|
+
# The constant's name
|
670
|
+
#
|
671
|
+
attr_accessor name: String
|
672
|
+
|
673
|
+
# <!-- rdoc-file=lib/rdoc/constant.rb -->
|
674
|
+
# The constant's value
|
675
|
+
#
|
676
|
+
attr_accessor value: String
|
677
|
+
|
678
|
+
# <!-- rdoc-file=lib/rdoc/constant.rb -->
|
679
|
+
# The constant's visibility
|
680
|
+
#
|
681
|
+
attr_accessor visibility: String
|
682
|
+
|
683
|
+
# <!--
|
684
|
+
# rdoc-file=lib/rdoc/constant.rb
|
685
|
+
# - new(name, value, comment)
|
686
|
+
# -->
|
687
|
+
# Creates a new constant with `name`, `value` and `comment`
|
688
|
+
#
|
689
|
+
def initialize: (String name, String value, RDoc::Comment? comment) -> void
|
690
|
+
end
|
691
|
+
|
692
|
+
# <!-- rdoc-file=lib/rdoc/mixin.rb -->
|
693
|
+
# A Mixin adds features from a module into another context. RDoc::Include and
|
694
|
+
# RDoc::Extend are both mixins.
|
695
|
+
#
|
696
|
+
class Mixin < CodeObject
|
697
|
+
# <!-- rdoc-file=lib/rdoc/mixin.rb -->
|
698
|
+
# Name of included module
|
699
|
+
#
|
700
|
+
attr_accessor name: String
|
701
|
+
|
702
|
+
# <!--
|
703
|
+
# rdoc-file=lib/rdoc/mixin.rb
|
704
|
+
# - new(name, comment)
|
705
|
+
# -->
|
706
|
+
# Creates a new Mixin for `name` with `comment`
|
707
|
+
#
|
708
|
+
def initialize: (String name, RDoc::Comment? comment) -> void
|
709
|
+
end
|
710
|
+
|
711
|
+
# <!-- rdoc-file=lib/rdoc/include.rb -->
|
712
|
+
# A Module included in a class with #include
|
713
|
+
#
|
714
|
+
# RDoc::Include.new 'Enumerable', 'comment ...'
|
715
|
+
#
|
716
|
+
class Include < Mixin
|
717
|
+
end
|
718
|
+
|
719
|
+
# <!-- rdoc-file=lib/rdoc/extend.rb -->
|
720
|
+
# A Module extension to a class with #extend
|
721
|
+
#
|
722
|
+
# RDoc::Extend.new 'Enumerable', 'comment ...'
|
723
|
+
#
|
724
|
+
class Extend < Mixin
|
725
|
+
end
|
726
|
+
|
727
|
+
# <!-- rdoc-file=lib/rdoc/alias.rb -->
|
728
|
+
# Represent an alias, which is an old_name/new_name pair associated with a
|
729
|
+
# particular context
|
730
|
+
#
|
731
|
+
class Alias < CodeObject
|
732
|
+
# <!-- rdoc-file=lib/rdoc/alias.rb -->
|
733
|
+
# Aliased method's name
|
734
|
+
#
|
735
|
+
attr_accessor name: String
|
736
|
+
|
737
|
+
# <!-- rdoc-file=lib/rdoc/alias.rb -->
|
738
|
+
# Aliasee method's name
|
739
|
+
#
|
740
|
+
attr_accessor old_name: String
|
741
|
+
|
742
|
+
# <!--
|
743
|
+
# rdoc-file=lib/rdoc/alias.rb
|
744
|
+
# - new(text, old_name, new_name, comment, singleton = false)
|
745
|
+
# -->
|
746
|
+
# Creates a new Alias with a token stream of `text` that aliases `old_name` to
|
747
|
+
# `new_name`, has `comment` and is a `singleton` context.
|
748
|
+
#
|
749
|
+
def initialize: (String? text, String name, String old_name, RDoc::Comment? comment, ?bool `singleton`) -> void
|
750
|
+
end
|
751
|
+
|
752
|
+
# <!-- rdoc-file=lib/rdoc/stats.rb -->
|
753
|
+
# RDoc statistics collector which prints a summary and report of a project's
|
754
|
+
# documentation totals.
|
755
|
+
#
|
756
|
+
class Stats
|
757
|
+
end
|
758
|
+
end
|