rbs 3.2.2 → 3.3.0.pre.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/comments.yml +1 -1
- data/.github/workflows/ruby.yml +7 -2
- data/CHANGELOG.md +85 -0
- data/Gemfile.lock +14 -14
- data/README.md +11 -2
- data/Rakefile +10 -7
- data/Steepfile +7 -7
- data/core/basic_object.rbs +7 -7
- data/core/binding.rbs +3 -3
- data/core/builtin.rbs +171 -5
- data/core/constants.rbs +17 -17
- data/core/dir.rbs +3 -3
- data/core/encoding.rbs +434 -628
- data/core/enumerator.rbs +37 -0
- data/core/exception.rbs +11 -11
- data/core/false_class.rbs +5 -11
- data/core/fiber.rbs +3 -3
- data/core/file_test.rbs +28 -26
- data/core/kernel.rbs +900 -21
- data/core/marshal.rbs +24 -14
- data/core/match_data.rbs +8 -8
- data/core/math.rbs +57 -53
- data/core/method.rbs +3 -1
- data/core/module.rbs +38 -36
- data/core/nil_class.rbs +7 -13
- data/core/object.rbs +3 -966
- data/core/process.rbs +3 -3
- data/core/ractor.rbs +2 -2
- data/core/rb_config.rbs +64 -43
- data/core/regexp.rbs +3 -3
- data/core/signal.rbs +10 -4
- data/core/struct.rbs +1 -1
- data/core/thread.rbs +7 -7
- data/core/thread_group.rbs +9 -9
- data/core/true_class.rbs +5 -11
- data/core/unbound_method.rbs +56 -7
- data/core/warning.rbs +33 -0
- data/docs/collection.md +56 -6
- data/docs/data_and_struct.md +57 -0
- data/docs/stdlib.md +61 -2
- data/docs/syntax.md +123 -2
- data/ext/rbs_extension/lexer.c +624 -569
- data/ext/rbs_extension/lexer.h +1 -0
- data/ext/rbs_extension/lexer.re +1 -0
- data/ext/rbs_extension/lexstate.c +1 -0
- data/ext/rbs_extension/parser.c +6 -0
- data/goodcheck.yml +2 -2
- data/lib/rbs/annotate/formatter.rb +13 -3
- data/lib/rbs/annotate/rdoc_source.rb +10 -1
- data/lib/rbs/cli/colored_io.rb +48 -0
- data/lib/rbs/cli/diff.rb +80 -0
- data/lib/rbs/cli.rb +151 -16
- data/lib/rbs/collection/config/lockfile.rb +0 -25
- data/lib/rbs/collection/config/lockfile_generator.rb +0 -6
- data/lib/rbs/collection/installer.rb +1 -1
- data/lib/rbs/collection/sources/git.rb +6 -4
- data/lib/rbs/collection/sources/local.rb +7 -5
- data/lib/rbs/diff.rb +104 -0
- data/lib/rbs/environment.rb +1 -1
- data/lib/rbs/method_type.rb +23 -0
- data/lib/rbs/prototype/rb.rb +2 -9
- data/lib/rbs/prototype/runtime/helpers.rb +59 -0
- data/lib/rbs/prototype/runtime/value_object_generator.rb +236 -0
- data/lib/rbs/prototype/runtime.rb +234 -150
- data/lib/rbs/sorter.rb +144 -117
- data/lib/rbs/test/guaranteed.rb +31 -0
- data/lib/rbs/test/type_check.rb +4 -4
- data/lib/rbs/test.rb +3 -0
- data/lib/rbs/types.rb +184 -3
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +4 -4
- data/lib/rbs.rb +1 -0
- data/rbs.gemspec +1 -0
- data/sig/annotate/formatter.rbs +2 -2
- data/sig/annotate/rdoc_annotater.rbs +1 -1
- data/sig/cli/colored_io.rbs +15 -0
- data/sig/cli/diff.rbs +21 -0
- data/sig/cli.rbs +2 -0
- data/sig/collection/config/lockfile.rbs +0 -6
- data/sig/diff.rbs +23 -0
- data/sig/errors.rbs +1 -5
- data/sig/method_types.rbs +6 -0
- data/sig/prototype/runtime.rbs +108 -0
- data/sig/rdoc/rbs.rbs +4 -0
- data/sig/shims/bundler.rbs +5 -0
- data/sig/sorter.rbs +23 -5
- data/sig/types.rbs +29 -0
- data/stdlib/benchmark/0/benchmark.rbs +1 -1
- data/stdlib/cgi/0/core.rbs +2 -2
- data/stdlib/did_you_mean/0/did_you_mean.rbs +2 -2
- data/stdlib/digest/0/digest.rbs +1 -1
- data/stdlib/fileutils/0/fileutils.rbs +1 -1
- data/stdlib/forwardable/0/forwardable.rbs +4 -4
- data/stdlib/io-console/0/io-console.rbs +1 -1
- data/stdlib/json/0/json.rbs +37 -0
- data/stdlib/logger/0/logger.rbs +2 -2
- data/stdlib/net-http/0/manifest.yaml +1 -1
- data/stdlib/net-http/0/net-http.rbs +16 -63
- data/stdlib/net-protocol/0/manifest.yaml +2 -0
- data/stdlib/net-protocol/0/net-protocol.rbs +56 -0
- data/stdlib/openssl/0/openssl.rbs +1 -1
- data/stdlib/pp/0/manifest.yaml +2 -0
- data/stdlib/pp/0/pp.rbs +301 -0
- data/stdlib/{yaml → psych}/0/dbm.rbs +3 -3
- data/stdlib/psych/0/manifest.yaml +3 -0
- data/stdlib/psych/0/psych.rbs +391 -0
- data/stdlib/{yaml → psych}/0/store.rbs +2 -2
- data/stdlib/rdoc/0/code_object.rbs +55 -0
- data/stdlib/rdoc/0/comment.rbs +60 -0
- data/stdlib/rdoc/0/context.rbs +153 -0
- data/stdlib/rdoc/0/markup.rbs +119 -0
- data/stdlib/rdoc/0/parser.rbs +56 -0
- data/stdlib/rdoc/0/rdoc.rbs +0 -372
- data/stdlib/rdoc/0/ri.rbs +17 -0
- data/stdlib/rdoc/0/store.rbs +48 -0
- data/stdlib/rdoc/0/top_level.rbs +97 -0
- data/stdlib/socket/0/basic_socket.rbs +1 -1
- data/stdlib/socket/0/socket.rbs +1 -1
- data/stdlib/uri/0/common.rbs +1 -1
- data/stdlib/yaml/0/manifest.yaml +1 -2
- data/stdlib/yaml/0/yaml.rbs +1 -199
- metadata +46 -9
- data/sig/shims/pp.rbs +0 -3
- data/sig/shims.rbs +0 -47
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
%a{annotate:rdoc:skip}
|
|
2
|
+
module RDoc
|
|
3
|
+
# <!-- rdoc-file=lib/rdoc/markup.rb -->
|
|
4
|
+
# RDoc::Markup parses plain text documents and attempts to decompose them into
|
|
5
|
+
# their constituent parts. Some of these parts are high-level: paragraphs,
|
|
6
|
+
# chunks of verbatim text, list entries and the like. Other parts happen at the
|
|
7
|
+
# character level: a piece of bold text, a word in code font. This markup is
|
|
8
|
+
# similar in spirit to that used on WikiWiki webs, where folks create web pages
|
|
9
|
+
# using a simple set of formatting rules.
|
|
10
|
+
#
|
|
11
|
+
# RDoc::Markup and other markup formats do no output formatting, this is handled
|
|
12
|
+
# by the RDoc::Markup::Formatter subclasses.
|
|
13
|
+
#
|
|
14
|
+
# # Supported Formats
|
|
15
|
+
#
|
|
16
|
+
# Besides the RDoc::Markup format, the following formats are built in to RDoc:
|
|
17
|
+
#
|
|
18
|
+
# markdown
|
|
19
|
+
# : The markdown format as described by
|
|
20
|
+
# http://daringfireball.net/projects/markdown/. See RDoc::Markdown for
|
|
21
|
+
# details on the parser and supported extensions.
|
|
22
|
+
# rd
|
|
23
|
+
# : The rdtool format. See RDoc::RD for details on the parser and format.
|
|
24
|
+
# tomdoc
|
|
25
|
+
# : The TomDoc format as described by http://tomdoc.org/. See RDoc::TomDoc
|
|
26
|
+
# for details on the parser and supported extensions.
|
|
27
|
+
#
|
|
28
|
+
#
|
|
29
|
+
# You can choose a markup format using the following methods:
|
|
30
|
+
#
|
|
31
|
+
# per project
|
|
32
|
+
# : If you build your documentation with rake use RDoc::Task#markup.
|
|
33
|
+
#
|
|
34
|
+
# If you build your documentation by hand run:
|
|
35
|
+
#
|
|
36
|
+
# rdoc --markup your_favorite_format --write-options
|
|
37
|
+
#
|
|
38
|
+
# and commit `.rdoc_options` and ship it with your packaged gem.
|
|
39
|
+
# per file
|
|
40
|
+
# : At the top of the file use the `:markup:` directive to set the default
|
|
41
|
+
# format for the rest of the file.
|
|
42
|
+
# per comment
|
|
43
|
+
# : Use the `:markup:` directive at the top of a comment you want to write in
|
|
44
|
+
# a different format.
|
|
45
|
+
#
|
|
46
|
+
#
|
|
47
|
+
# # RDoc::Markup
|
|
48
|
+
#
|
|
49
|
+
# RDoc::Markup is extensible at runtime: you can add new markup elements to be
|
|
50
|
+
# recognized in the documents that RDoc::Markup parses.
|
|
51
|
+
#
|
|
52
|
+
# RDoc::Markup is intended to be the basis for a family of tools which share the
|
|
53
|
+
# common requirement that simple, plain-text should be rendered in a variety of
|
|
54
|
+
# different output formats and media. It is envisaged that RDoc::Markup could
|
|
55
|
+
# be the basis for formatting RDoc style comment blocks, Wiki entries, and
|
|
56
|
+
# online FAQs.
|
|
57
|
+
#
|
|
58
|
+
# ## Synopsis
|
|
59
|
+
#
|
|
60
|
+
# This code converts `input_string` to HTML. The conversion takes place in the
|
|
61
|
+
# `convert` method, so you can use the same RDoc::Markup converter to convert
|
|
62
|
+
# multiple input strings.
|
|
63
|
+
#
|
|
64
|
+
# require 'rdoc'
|
|
65
|
+
#
|
|
66
|
+
# h = RDoc::Markup::ToHtml.new(RDoc::Options.new)
|
|
67
|
+
#
|
|
68
|
+
# puts h.convert(input_string)
|
|
69
|
+
#
|
|
70
|
+
# You can extend the RDoc::Markup parser to recognize new markup sequences, and
|
|
71
|
+
# to add regexp handling. Here we make WikiWords significant to the parser, and
|
|
72
|
+
# also make the sequences {word} and <no>text...</no> signify strike-through
|
|
73
|
+
# text. We then subclass the HTML output class to deal with these:
|
|
74
|
+
#
|
|
75
|
+
# require 'rdoc'
|
|
76
|
+
#
|
|
77
|
+
# class WikiHtml < RDoc::Markup::ToHtml
|
|
78
|
+
# def handle_regexp_WIKIWORD(target)
|
|
79
|
+
# "<font color=red>" + target.text + "</font>"
|
|
80
|
+
# end
|
|
81
|
+
# end
|
|
82
|
+
#
|
|
83
|
+
# markup = RDoc::Markup.new
|
|
84
|
+
# markup.add_word_pair("{", "}", :STRIKE)
|
|
85
|
+
# markup.add_html("no", :STRIKE)
|
|
86
|
+
#
|
|
87
|
+
# markup.add_regexp_handling(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
|
|
88
|
+
#
|
|
89
|
+
# wh = WikiHtml.new RDoc::Options.new, markup
|
|
90
|
+
# wh.add_tag(:STRIKE, "<strike>", "</strike>")
|
|
91
|
+
#
|
|
92
|
+
# puts "<body>#{wh.convert ARGF.read}</body>"
|
|
93
|
+
#
|
|
94
|
+
# ## Encoding
|
|
95
|
+
#
|
|
96
|
+
# Where Encoding support is available, RDoc will automatically convert all
|
|
97
|
+
# documents to the same output encoding. The output encoding can be set via
|
|
98
|
+
# RDoc::Options#encoding and defaults to Encoding.default_external.
|
|
99
|
+
#
|
|
100
|
+
# # RDoc Markup Reference
|
|
101
|
+
#
|
|
102
|
+
# See RDoc::MarkupReference.
|
|
103
|
+
#
|
|
104
|
+
class Markup
|
|
105
|
+
class Document
|
|
106
|
+
include Enumerable[Document]
|
|
107
|
+
|
|
108
|
+
def each: () { (Document) -> void } -> void
|
|
109
|
+
| () -> Enumerator[Document, void]
|
|
110
|
+
|
|
111
|
+
def file: () -> String?
|
|
112
|
+
|
|
113
|
+
def accept: (untyped) -> String
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
class ToMarkdown
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
%a{annotate:rdoc:skip}
|
|
2
|
+
module RDoc
|
|
3
|
+
# <!-- rdoc-file=lib/rdoc/parser.rb -->
|
|
4
|
+
# A parser is simple a class that subclasses RDoc::Parser and implements #scan
|
|
5
|
+
# to fill in an RDoc::TopLevel with parsed data.
|
|
6
|
+
#
|
|
7
|
+
# The initialize method takes an RDoc::TopLevel to fill with parsed content, the
|
|
8
|
+
# name of the file to be parsed, the content of the file, an RDoc::Options
|
|
9
|
+
# object and an RDoc::Stats object to inform the user of parsed items. The scan
|
|
10
|
+
# method is then called to parse the file and must return the RDoc::TopLevel
|
|
11
|
+
# object. By calling super these items will be set for you.
|
|
12
|
+
#
|
|
13
|
+
# In order to be used by RDoc the parser needs to register the file extensions
|
|
14
|
+
# it can parse. Use ::parse_files_matching to register extensions.
|
|
15
|
+
#
|
|
16
|
+
# require 'rdoc'
|
|
17
|
+
#
|
|
18
|
+
# class RDoc::Parser::Xyz < RDoc::Parser
|
|
19
|
+
# parse_files_matching /\.xyz$/
|
|
20
|
+
#
|
|
21
|
+
# def initialize top_level, file_name, content, options, stats
|
|
22
|
+
# super
|
|
23
|
+
#
|
|
24
|
+
# # extra initialization if needed
|
|
25
|
+
# end
|
|
26
|
+
#
|
|
27
|
+
# def scan
|
|
28
|
+
# # parse file and fill in @top_level
|
|
29
|
+
# end
|
|
30
|
+
# end
|
|
31
|
+
#
|
|
32
|
+
class Parser
|
|
33
|
+
# <!--
|
|
34
|
+
# rdoc-file=lib/rdoc/parser.rb
|
|
35
|
+
# - parse_files_matching(regexp)
|
|
36
|
+
# -->
|
|
37
|
+
# Record which file types this parser can understand.
|
|
38
|
+
#
|
|
39
|
+
# It is ok to call this multiple times.
|
|
40
|
+
#
|
|
41
|
+
def self?.parse_files_matching: (Regexp path) -> void
|
|
42
|
+
|
|
43
|
+
# <!--
|
|
44
|
+
# rdoc-file=lib/rdoc/parser.rb
|
|
45
|
+
# - new(top_level, file_name, content, options, stats)
|
|
46
|
+
# -->
|
|
47
|
+
# Creates a new Parser storing `top_level`, `file_name`, `content`, `options`
|
|
48
|
+
# and `stats` in instance variables. In +@preprocess+ an
|
|
49
|
+
# RDoc::Markup::PreProcess object is created which allows processing of
|
|
50
|
+
# directives.
|
|
51
|
+
#
|
|
52
|
+
def initialize: (RDoc::TopLevel top_level, String filename, String content, Hash[untyped, untyped] options, RDoc::Stats stats) -> void
|
|
53
|
+
|
|
54
|
+
def scan: () -> RDoc::TopLevel
|
|
55
|
+
end
|
|
56
|
+
end
|
data/stdlib/rdoc/0/rdoc.rbs
CHANGED
|
@@ -57,339 +57,6 @@
|
|
|
57
57
|
# for irb and the rtags package.
|
|
58
58
|
#
|
|
59
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
60
|
# <!-- rdoc-file=lib/rdoc/token_stream.rb -->
|
|
394
61
|
# A TokenStream is a list of tokens, gathered during the parse of some entity
|
|
395
62
|
# (say a method). Entities populate these streams by being registered with the
|
|
@@ -422,45 +89,6 @@ module RDoc
|
|
|
422
89
|
alias start_collecting_tokens collect_tokens
|
|
423
90
|
end
|
|
424
91
|
|
|
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
92
|
# <!-- rdoc-file=lib/rdoc/class_module.rb -->
|
|
465
93
|
# ClassModule is the base class for objects representing either a class or a
|
|
466
94
|
# module.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
%a{annotate:rdoc:skip}
|
|
2
|
+
module RDoc
|
|
3
|
+
# <!-- rdoc-file=lib/rdoc/ri.rb -->
|
|
4
|
+
# Namespace for the ri command line tool's implementation.
|
|
5
|
+
#
|
|
6
|
+
# See `ri --help` for details.
|
|
7
|
+
#
|
|
8
|
+
module RI
|
|
9
|
+
module Paths
|
|
10
|
+
type path_type = :system | :site | :home | :gem | :extra
|
|
11
|
+
|
|
12
|
+
type gem_filter = :latest | :all
|
|
13
|
+
|
|
14
|
+
def self.each: (?bool system, ?bool site, ?bool home, ?gem_filter | false gems, *String extra_dirs) { (String, path_type) -> void } -> void
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
%a{annotate:rdoc:skip}
|
|
2
|
+
module RDoc
|
|
3
|
+
# <!-- rdoc-file=lib/rdoc/store.rb -->
|
|
4
|
+
# A set of rdoc data for a single project (gem, path, etc.).
|
|
5
|
+
#
|
|
6
|
+
# The store manages reading and writing ri data for a project and maintains a
|
|
7
|
+
# cache of methods, classes and ancestors in the store.
|
|
8
|
+
#
|
|
9
|
+
# The store maintains a #cache of its contents for faster lookup. After adding
|
|
10
|
+
# items to the store it must be flushed using #save_cache. The cache contains
|
|
11
|
+
# the following structures:
|
|
12
|
+
#
|
|
13
|
+
# @cache = {
|
|
14
|
+
# :ancestors => {}, # class name => ancestor names
|
|
15
|
+
# :attributes => {}, # class name => attributes
|
|
16
|
+
# :class_methods => {}, # class name => class methods
|
|
17
|
+
# :instance_methods => {}, # class name => instance methods
|
|
18
|
+
# :modules => [], # classes and modules in this store
|
|
19
|
+
# :pages => [], # page names
|
|
20
|
+
# }
|
|
21
|
+
#
|
|
22
|
+
class Store
|
|
23
|
+
# <!--
|
|
24
|
+
# rdoc-file=lib/rdoc/store.rb
|
|
25
|
+
# - new(path = nil, type = nil)
|
|
26
|
+
# -->
|
|
27
|
+
# Creates a new Store of `type` that will load or save to `path`
|
|
28
|
+
#
|
|
29
|
+
def initialize: (?String? path, ?Symbol? type) -> void
|
|
30
|
+
|
|
31
|
+
# <!--
|
|
32
|
+
# rdoc-file=lib/rdoc/store.rb
|
|
33
|
+
# - find_class_or_module(name)
|
|
34
|
+
# -->
|
|
35
|
+
# Finds the class or module with `name`
|
|
36
|
+
#
|
|
37
|
+
def find_class_or_module: (String) -> ClassModule?
|
|
38
|
+
|
|
39
|
+
# <!--
|
|
40
|
+
# rdoc-file=lib/rdoc/store.rb
|
|
41
|
+
# - load_all()
|
|
42
|
+
# -->
|
|
43
|
+
# Loads all items from this store into memory. This recreates a documentation
|
|
44
|
+
# tree for use by a generator
|
|
45
|
+
#
|
|
46
|
+
def load_all: () -> void
|
|
47
|
+
end
|
|
48
|
+
end
|