rbs 4.0.0.dev.4 → 4.0.0
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/dependabot.yml +14 -14
- data/.github/workflows/bundle-update.yml +60 -0
- data/.github/workflows/c-check.yml +18 -11
- data/.github/workflows/comments.yml +5 -3
- data/.github/workflows/dependabot.yml +2 -2
- data/.github/workflows/ruby.yml +27 -34
- data/.github/workflows/rust.yml +95 -0
- data/.github/workflows/typecheck.yml +2 -2
- data/.github/workflows/windows.yml +2 -2
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +323 -0
- data/README.md +1 -1
- data/Rakefile +43 -33
- data/Steepfile +1 -0
- data/config.yml +426 -24
- data/core/array.rbs +307 -227
- data/core/basic_object.rbs +9 -8
- data/core/binding.rbs +0 -2
- data/core/builtin.rbs +2 -2
- data/core/class.rbs +6 -5
- data/core/comparable.rbs +55 -34
- data/core/complex.rbs +104 -78
- data/core/dir.rbs +61 -49
- data/core/encoding.rbs +12 -15
- data/core/enumerable.rbs +179 -87
- data/core/enumerator/arithmetic_sequence.rbs +70 -0
- data/core/enumerator.rbs +65 -2
- data/core/errno.rbs +11 -2
- data/core/errors.rbs +58 -29
- data/core/exception.rbs +13 -13
- data/core/fiber.rbs +74 -54
- data/core/file.rbs +280 -177
- data/core/file_test.rbs +3 -3
- data/core/float.rbs +257 -92
- data/core/gc.rbs +425 -281
- data/core/hash.rbs +1045 -739
- data/core/integer.rbs +135 -137
- data/core/io/buffer.rbs +53 -42
- data/core/io/wait.rbs +13 -35
- data/core/io.rbs +192 -144
- data/core/kernel.rbs +216 -155
- data/core/marshal.rbs +4 -4
- data/core/match_data.rbs +15 -13
- data/core/math.rbs +107 -66
- data/core/method.rbs +69 -33
- data/core/module.rbs +244 -106
- data/core/nil_class.rbs +7 -6
- data/core/numeric.rbs +74 -63
- data/core/object.rbs +9 -11
- data/core/object_space.rbs +30 -23
- data/core/pathname.rbs +1322 -0
- data/core/proc.rbs +95 -58
- data/core/process.rbs +222 -202
- data/core/ractor.rbs +371 -515
- data/core/random.rbs +21 -3
- data/core/range.rbs +159 -57
- data/core/rational.rbs +60 -89
- data/core/rbs/unnamed/argf.rbs +60 -53
- data/core/rbs/unnamed/env_class.rbs +19 -14
- data/core/rbs/unnamed/main_class.rbs +123 -0
- data/core/rbs/unnamed/random.rbs +11 -118
- data/core/regexp.rbs +258 -214
- data/core/ruby.rbs +53 -0
- data/core/ruby_vm.rbs +38 -34
- data/core/rubygems/config_file.rbs +5 -5
- data/core/rubygems/errors.rbs +4 -71
- data/core/rubygems/requirement.rbs +5 -5
- data/core/rubygems/rubygems.rbs +16 -82
- data/core/rubygems/version.rbs +2 -3
- data/core/set.rbs +490 -360
- data/core/signal.rbs +26 -16
- data/core/string.rbs +3234 -1285
- data/core/struct.rbs +27 -26
- data/core/symbol.rbs +41 -34
- data/core/thread.rbs +135 -67
- data/core/time.rbs +81 -50
- data/core/trace_point.rbs +41 -35
- data/core/true_class.rbs +2 -2
- data/core/unbound_method.rbs +24 -16
- data/core/warning.rbs +7 -7
- data/docs/aliases.md +79 -0
- data/docs/collection.md +3 -3
- data/docs/config.md +171 -0
- data/docs/encoding.md +56 -0
- data/docs/gem.md +0 -1
- data/docs/inline.md +576 -0
- data/docs/sigs.md +3 -3
- data/docs/syntax.md +46 -16
- data/docs/type_fingerprint.md +21 -0
- data/exe/rbs +1 -1
- data/ext/rbs_extension/ast_translation.c +544 -116
- data/ext/rbs_extension/ast_translation.h +3 -0
- data/ext/rbs_extension/class_constants.c +16 -2
- data/ext/rbs_extension/class_constants.h +8 -0
- data/ext/rbs_extension/extconf.rb +5 -1
- data/ext/rbs_extension/legacy_location.c +33 -56
- data/ext/rbs_extension/legacy_location.h +37 -0
- data/ext/rbs_extension/main.c +44 -35
- data/include/rbs/ast.h +448 -173
- data/include/rbs/defines.h +27 -0
- data/include/rbs/lexer.h +30 -11
- data/include/rbs/location.h +25 -44
- data/include/rbs/parser.h +6 -6
- data/include/rbs/string.h +0 -2
- data/include/rbs/util/rbs_allocator.h +34 -13
- data/include/rbs/util/rbs_assert.h +12 -1
- data/include/rbs/util/rbs_constant_pool.h +0 -3
- data/include/rbs/util/rbs_encoding.h +2 -0
- data/include/rbs/util/rbs_unescape.h +2 -1
- data/include/rbs.h +8 -0
- data/lib/rbs/ast/annotation.rb +1 -1
- data/lib/rbs/ast/comment.rb +1 -1
- data/lib/rbs/ast/declarations.rb +10 -10
- data/lib/rbs/ast/members.rb +14 -14
- data/lib/rbs/ast/ruby/annotations.rb +293 -3
- data/lib/rbs/ast/ruby/comment_block.rb +24 -0
- data/lib/rbs/ast/ruby/declarations.rb +198 -3
- data/lib/rbs/ast/ruby/helpers/constant_helper.rb +4 -0
- data/lib/rbs/ast/ruby/members.rb +532 -22
- data/lib/rbs/ast/type_param.rb +24 -4
- data/lib/rbs/buffer.rb +20 -15
- data/lib/rbs/cli/diff.rb +16 -15
- data/lib/rbs/cli/validate.rb +38 -106
- data/lib/rbs/cli.rb +52 -19
- data/lib/rbs/collection/config/lockfile_generator.rb +14 -2
- data/lib/rbs/collection/sources/git.rb +1 -0
- data/lib/rbs/definition.rb +1 -1
- data/lib/rbs/definition_builder/ancestor_builder.rb +62 -9
- data/lib/rbs/definition_builder/method_builder.rb +20 -0
- data/lib/rbs/definition_builder.rb +147 -25
- data/lib/rbs/diff.rb +7 -1
- data/lib/rbs/environment.rb +227 -74
- data/lib/rbs/environment_loader.rb +0 -6
- data/lib/rbs/errors.rb +27 -18
- data/lib/rbs/inline_parser.rb +342 -6
- data/lib/rbs/location_aux.rb +1 -1
- data/lib/rbs/locator.rb +5 -1
- data/lib/rbs/method_type.rb +5 -3
- data/lib/rbs/parser_aux.rb +20 -7
- data/lib/rbs/prototype/helpers.rb +57 -0
- data/lib/rbs/prototype/rb.rb +3 -28
- data/lib/rbs/prototype/rbi.rb +3 -20
- data/lib/rbs/prototype/runtime.rb +8 -0
- data/lib/rbs/resolver/constant_resolver.rb +2 -2
- data/lib/rbs/resolver/type_name_resolver.rb +116 -38
- data/lib/rbs/subtractor.rb +3 -1
- data/lib/rbs/test/type_check.rb +19 -2
- data/lib/rbs/type_name.rb +1 -1
- data/lib/rbs/types.rb +88 -78
- data/lib/rbs/unit_test/type_assertions.rb +35 -8
- data/lib/rbs/validator.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +1 -2
- data/lib/rdoc/discover.rb +1 -1
- data/lib/rdoc_plugin/parser.rb +1 -1
- data/rbs.gemspec +4 -3
- data/rust/.gitignore +1 -0
- data/rust/Cargo.lock +378 -0
- data/rust/Cargo.toml +7 -0
- data/rust/ruby-rbs/Cargo.toml +22 -0
- data/rust/ruby-rbs/build.rs +764 -0
- data/rust/ruby-rbs/examples/locations.rs +60 -0
- data/rust/ruby-rbs/src/lib.rs +1 -0
- data/rust/ruby-rbs/src/node/mod.rs +742 -0
- data/rust/ruby-rbs/tests/sanity.rs +47 -0
- data/rust/ruby-rbs/vendor/rbs/config.yml +1 -0
- data/rust/ruby-rbs-sys/Cargo.toml +23 -0
- data/rust/ruby-rbs-sys/build.rs +204 -0
- data/rust/ruby-rbs-sys/src/lib.rs +50 -0
- data/rust/ruby-rbs-sys/vendor/rbs/include +1 -0
- data/rust/ruby-rbs-sys/vendor/rbs/src +1 -0
- data/rust/ruby-rbs-sys/wrapper.h +1 -0
- data/schema/typeParam.json +17 -1
- data/sig/ast/ruby/annotations.rbs +315 -4
- data/sig/ast/ruby/comment_block.rbs +8 -0
- data/sig/ast/ruby/declarations.rbs +102 -4
- data/sig/ast/ruby/members.rbs +108 -2
- data/sig/cli/diff.rbs +5 -11
- data/sig/cli/validate.rbs +12 -8
- data/sig/cli.rbs +18 -18
- data/sig/definition.rbs +6 -1
- data/sig/definition_builder.rbs +2 -0
- data/sig/environment.rbs +70 -12
- data/sig/errors.rbs +13 -14
- data/sig/inline_parser.rbs +39 -2
- data/sig/locator.rbs +0 -2
- data/sig/manifest.yaml +0 -1
- data/sig/method_builder.rbs +3 -1
- data/sig/parser.rbs +31 -13
- data/sig/prototype/helpers.rbs +2 -0
- data/sig/resolver/type_name_resolver.rbs +35 -7
- data/sig/source.rbs +3 -3
- data/sig/type_param.rbs +13 -8
- data/sig/types.rbs +6 -7
- data/sig/unit_test/spy.rbs +0 -8
- data/sig/unit_test/type_assertions.rbs +11 -0
- data/src/ast.c +410 -153
- data/src/lexer.c +1392 -1313
- data/src/lexer.re +3 -0
- data/src/lexstate.c +58 -37
- data/src/location.c +8 -48
- data/src/parser.c +977 -516
- data/src/string.c +0 -48
- data/src/util/rbs_allocator.c +89 -71
- data/src/util/rbs_assert.c +1 -1
- data/src/util/rbs_buffer.c +2 -2
- data/src/util/rbs_constant_pool.c +10 -14
- data/src/util/rbs_encoding.c +4 -8
- data/src/util/rbs_unescape.c +56 -20
- data/stdlib/bigdecimal/0/big_decimal.rbs +116 -98
- data/stdlib/bigdecimal-math/0/big_math.rbs +169 -8
- data/stdlib/cgi/0/core.rbs +9 -393
- data/stdlib/cgi/0/manifest.yaml +1 -0
- data/stdlib/cgi-escape/0/escape.rbs +171 -0
- data/stdlib/coverage/0/coverage.rbs +7 -4
- data/stdlib/date/0/date.rbs +92 -79
- data/stdlib/date/0/date_time.rbs +25 -24
- data/stdlib/delegate/0/delegator.rbs +10 -7
- data/stdlib/did_you_mean/0/did_you_mean.rbs +17 -16
- data/stdlib/digest/0/digest.rbs +110 -0
- data/stdlib/erb/0/erb.rbs +748 -347
- data/stdlib/etc/0/etc.rbs +55 -50
- data/stdlib/fileutils/0/fileutils.rbs +158 -139
- data/stdlib/forwardable/0/forwardable.rbs +13 -10
- data/stdlib/io-console/0/io-console.rbs +2 -2
- data/stdlib/json/0/json.rbs +217 -136
- data/stdlib/monitor/0/monitor.rbs +3 -3
- data/stdlib/net-http/0/net-http.rbs +162 -134
- data/stdlib/objspace/0/objspace.rbs +17 -34
- data/stdlib/open-uri/0/open-uri.rbs +48 -8
- data/stdlib/open3/0/open3.rbs +469 -10
- data/stdlib/openssl/0/openssl.rbs +475 -357
- data/stdlib/optparse/0/optparse.rbs +26 -17
- data/stdlib/pathname/0/pathname.rbs +11 -1381
- data/stdlib/pp/0/pp.rbs +9 -8
- data/stdlib/prettyprint/0/prettyprint.rbs +7 -7
- data/stdlib/pstore/0/pstore.rbs +35 -30
- data/stdlib/psych/0/psych.rbs +65 -12
- data/stdlib/psych/0/store.rbs +2 -4
- data/stdlib/pty/0/pty.rbs +9 -6
- data/stdlib/random-formatter/0/random-formatter.rbs +277 -0
- data/stdlib/rdoc/0/code_object.rbs +2 -1
- data/stdlib/rdoc/0/parser.rbs +1 -1
- data/stdlib/rdoc/0/rdoc.rbs +1 -1
- data/stdlib/rdoc/0/store.rbs +1 -1
- data/stdlib/resolv/0/resolv.rbs +25 -68
- data/stdlib/ripper/0/ripper.rbs +22 -19
- data/stdlib/securerandom/0/manifest.yaml +2 -0
- data/stdlib/securerandom/0/securerandom.rbs +7 -20
- data/stdlib/shellwords/0/shellwords.rbs +2 -2
- data/stdlib/singleton/0/singleton.rbs +3 -0
- data/stdlib/socket/0/addrinfo.rbs +7 -7
- data/stdlib/socket/0/basic_socket.rbs +3 -3
- data/stdlib/socket/0/ip_socket.rbs +10 -8
- data/stdlib/socket/0/socket.rbs +23 -10
- data/stdlib/socket/0/tcp_server.rbs +1 -1
- data/stdlib/socket/0/tcp_socket.rbs +11 -3
- data/stdlib/socket/0/udp_socket.rbs +1 -1
- data/stdlib/socket/0/unix_server.rbs +1 -1
- data/stdlib/stringio/0/stringio.rbs +1177 -85
- data/stdlib/strscan/0/string_scanner.rbs +27 -25
- data/stdlib/tempfile/0/tempfile.rbs +25 -21
- data/stdlib/time/0/time.rbs +8 -6
- data/stdlib/timeout/0/timeout.rbs +63 -7
- data/stdlib/tsort/0/cyclic.rbs +3 -0
- data/stdlib/tsort/0/tsort.rbs +7 -6
- data/stdlib/uri/0/common.rbs +42 -20
- data/stdlib/uri/0/file.rbs +3 -3
- data/stdlib/uri/0/generic.rbs +26 -18
- data/stdlib/uri/0/http.rbs +2 -2
- data/stdlib/uri/0/ldap.rbs +2 -2
- data/stdlib/uri/0/mailto.rbs +3 -3
- data/stdlib/uri/0/rfc2396_parser.rbs +12 -12
- data/stdlib/zlib/0/deflate.rbs +4 -3
- data/stdlib/zlib/0/gzip_reader.rbs +6 -6
- data/stdlib/zlib/0/gzip_writer.rbs +14 -12
- data/stdlib/zlib/0/inflate.rbs +1 -1
- data/stdlib/zlib/0/need_dict.rbs +1 -1
- data/stdlib/zlib/0/zstream.rbs +1 -0
- metadata +50 -6
data/core/module.rbs
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# methods may not. (See Module#module_function.)
|
|
7
7
|
#
|
|
8
8
|
# In the descriptions that follow, the parameter *sym* refers to a symbol, which
|
|
9
|
-
# is either a quoted string or a Symbol (such as
|
|
9
|
+
# is either a quoted string or a Symbol (such as <code>:name</code>).
|
|
10
10
|
#
|
|
11
11
|
# module Mod
|
|
12
12
|
# include Math
|
|
@@ -79,7 +79,7 @@ class Module < Object
|
|
|
79
79
|
# using B
|
|
80
80
|
# p Module.used_modules
|
|
81
81
|
#
|
|
82
|
-
#
|
|
82
|
+
# <em>produces:</em>
|
|
83
83
|
#
|
|
84
84
|
# [B, A]
|
|
85
85
|
#
|
|
@@ -106,7 +106,7 @@ class Module < Object
|
|
|
106
106
|
# using B
|
|
107
107
|
# p Module.used_refinements
|
|
108
108
|
#
|
|
109
|
-
#
|
|
109
|
+
# <em>produces:</em>
|
|
110
110
|
#
|
|
111
111
|
# [#<refinement:Object@B>, #<refinement:Object@A>]
|
|
112
112
|
#
|
|
@@ -114,12 +114,15 @@ class Module < Object
|
|
|
114
114
|
|
|
115
115
|
# <!--
|
|
116
116
|
# rdoc-file=object.c
|
|
117
|
-
# -
|
|
117
|
+
# - self < other -> true, false, or nil
|
|
118
118
|
# -->
|
|
119
|
-
# Returns
|
|
120
|
-
#
|
|
121
|
-
#
|
|
122
|
-
#
|
|
119
|
+
# Returns whether `self` is a subclass of `other`, or `nil` if there is no
|
|
120
|
+
# relationship between the two:
|
|
121
|
+
#
|
|
122
|
+
# Float < Numeric # => true
|
|
123
|
+
# Numeric < Float # => false
|
|
124
|
+
# Float < Float # => false
|
|
125
|
+
# Float < Hash # => nil
|
|
123
126
|
#
|
|
124
127
|
def <: (Module other) -> bool?
|
|
125
128
|
|
|
@@ -135,14 +138,30 @@ class Module < Object
|
|
|
135
138
|
|
|
136
139
|
# <!--
|
|
137
140
|
# rdoc-file=object.c
|
|
138
|
-
# -
|
|
141
|
+
# - self <=> other -> -1, 0, 1, or nil
|
|
139
142
|
# -->
|
|
140
|
-
#
|
|
141
|
-
#
|
|
142
|
-
#
|
|
143
|
+
# Compares `self` and `other`.
|
|
144
|
+
#
|
|
145
|
+
# Returns:
|
|
146
|
+
#
|
|
147
|
+
# * <code>-1</code>, if `self` includes `other`, if or `self` is a subclass of
|
|
148
|
+
# `other`.
|
|
149
|
+
# * `0`, if `self` and `other` are the same.
|
|
150
|
+
# * `1`, if `other` includes `self`, or if `other` is a subclass of `self`.
|
|
151
|
+
# * `nil`, if none of the above is true.
|
|
152
|
+
#
|
|
153
|
+
# Examples:
|
|
143
154
|
#
|
|
144
|
-
#
|
|
145
|
-
#
|
|
155
|
+
# # Class Array includes module Enumerable.
|
|
156
|
+
# Array <=> Enumerable # => -1
|
|
157
|
+
# Enumerable <=> Enumerable # => 0
|
|
158
|
+
# Enumerable <=> Array # => 1
|
|
159
|
+
# # Class File is a subclass of class IO.
|
|
160
|
+
# File <=> IO # => -1
|
|
161
|
+
# File <=> File # => 0
|
|
162
|
+
# IO <=> File # => 1
|
|
163
|
+
# # Class File has no relationship to class String.
|
|
164
|
+
# File <=> String # => nil
|
|
146
165
|
#
|
|
147
166
|
def <=>: (untyped other) -> Integer?
|
|
148
167
|
|
|
@@ -157,8 +176,8 @@ class Module < Object
|
|
|
157
176
|
# classes to provide class-specific meaning.
|
|
158
177
|
#
|
|
159
178
|
# Unlike #==, the #equal? method should never be overridden by subclasses as it
|
|
160
|
-
# is used to determine object identity (that is,
|
|
161
|
-
# `a` is the same object as `b`):
|
|
179
|
+
# is used to determine object identity (that is, <code>a.equal?(b)</code> if and
|
|
180
|
+
# only if `a` is the same object as `b`):
|
|
162
181
|
#
|
|
163
182
|
# obj = "a"
|
|
164
183
|
# other = obj.dup
|
|
@@ -231,7 +250,7 @@ class Module < Object
|
|
|
231
250
|
# include Mod
|
|
232
251
|
# exit(99)
|
|
233
252
|
#
|
|
234
|
-
#
|
|
253
|
+
# <em>produces:</em>
|
|
235
254
|
#
|
|
236
255
|
# Exiting with code 99
|
|
237
256
|
#
|
|
@@ -266,7 +285,7 @@ class Module < Object
|
|
|
266
285
|
# module to *mod* if this module has not already been added to *mod* or one of
|
|
267
286
|
# its ancestors. See also Module#include.
|
|
268
287
|
#
|
|
269
|
-
def append_features: (Module arg0) -> self
|
|
288
|
+
private def append_features: (Module arg0) -> self
|
|
270
289
|
|
|
271
290
|
# <!--
|
|
272
291
|
# rdoc-file=object.c
|
|
@@ -274,10 +293,10 @@ class Module < Object
|
|
|
274
293
|
# - attr_accessor(string, ...) -> array
|
|
275
294
|
# -->
|
|
276
295
|
# Defines a named attribute for this module, where the name is
|
|
277
|
-
#
|
|
278
|
-
# corresponding access method to read it. Also creates a method called
|
|
279
|
-
# to set the attribute. String arguments are converted to
|
|
280
|
-
# array of defined method names as symbols.
|
|
296
|
+
# <em>symbol.</em>`id2name`, creating an instance variable (<code>@name</code>)
|
|
297
|
+
# and a corresponding access method to read it. Also creates a method called
|
|
298
|
+
# <code>name=</code> to set the attribute. String arguments are converted to
|
|
299
|
+
# symbols. Returns an array of defined method names as symbols.
|
|
281
300
|
#
|
|
282
301
|
# module Mod
|
|
283
302
|
# attr_accessor(:one, :two) #=> [:one, :one=, :two, :two=]
|
|
@@ -294,8 +313,8 @@ class Module < Object
|
|
|
294
313
|
# - attr(string, ...) -> array
|
|
295
314
|
# -->
|
|
296
315
|
# Creates instance variables and corresponding methods that return the value of
|
|
297
|
-
# each instance variable. Equivalent to calling ```attr
|
|
298
|
-
# in turn. String arguments are converted to symbols. Returns an array of
|
|
316
|
+
# each instance variable. Equivalent to calling ```attr`<em>:name</em>'' on each
|
|
317
|
+
# name in turn. String arguments are converted to symbols. Returns an array of
|
|
299
318
|
# defined method names as symbols.
|
|
300
319
|
#
|
|
301
320
|
def attr_reader: (*interned arg0) -> Array[Symbol]
|
|
@@ -306,8 +325,8 @@ class Module < Object
|
|
|
306
325
|
# - attr_writer(string, ...) -> array
|
|
307
326
|
# -->
|
|
308
327
|
# Creates an accessor method to allow assignment to the attribute
|
|
309
|
-
# *symbol
|
|
310
|
-
# array of defined method names as symbols.
|
|
328
|
+
# *symbol*<code>.id2name</code>. String arguments are converted to symbols.
|
|
329
|
+
# Returns an array of defined method names as symbols.
|
|
311
330
|
#
|
|
312
331
|
def attr_writer: (*interned arg0) -> Array[Symbol]
|
|
313
332
|
|
|
@@ -328,6 +347,8 @@ class Module < Object
|
|
|
328
347
|
# replaced with *filename*. If *const* is defined but not as autoload, does
|
|
329
348
|
# nothing.
|
|
330
349
|
#
|
|
350
|
+
# Files that are currently being loaded must not be registered for autoload.
|
|
351
|
+
#
|
|
331
352
|
def autoload: (interned _module, String filename) -> NilClass
|
|
332
353
|
|
|
333
354
|
# <!--
|
|
@@ -370,7 +391,7 @@ class Module < Object
|
|
|
370
391
|
# puts Thing.new.hello()
|
|
371
392
|
# Thing.module_eval("invalid code", "dummy", 123)
|
|
372
393
|
#
|
|
373
|
-
#
|
|
394
|
+
# <em>produces:</em>
|
|
374
395
|
#
|
|
375
396
|
# Hello there!
|
|
376
397
|
# dummy:123:in `module_eval': undefined local variable
|
|
@@ -392,7 +413,7 @@ class Module < Object
|
|
|
392
413
|
# }
|
|
393
414
|
# puts Thing.new.hello()
|
|
394
415
|
#
|
|
395
|
-
#
|
|
416
|
+
# <em>produces:</em>
|
|
396
417
|
#
|
|
397
418
|
# Hello there!
|
|
398
419
|
#
|
|
@@ -420,8 +441,8 @@ class Module < Object
|
|
|
420
441
|
# - mod.class_variable_get(string) -> obj
|
|
421
442
|
# -->
|
|
422
443
|
# Returns the value of the given class variable (or throws a NameError
|
|
423
|
-
# exception). The
|
|
424
|
-
# class variables. String arguments are converted to symbols.
|
|
444
|
+
# exception). The <code>@@</code> part of the variable name should be included
|
|
445
|
+
# for regular class variables. String arguments are converted to symbols.
|
|
425
446
|
#
|
|
426
447
|
# class Fred
|
|
427
448
|
# @@foo = 99
|
|
@@ -483,11 +504,36 @@ class Module < Object
|
|
|
483
504
|
# FOO = 1
|
|
484
505
|
# end
|
|
485
506
|
#
|
|
486
|
-
#
|
|
507
|
+
# <em>produces:</em>
|
|
487
508
|
#
|
|
488
509
|
# Added :FOO
|
|
489
510
|
#
|
|
490
|
-
|
|
511
|
+
# If we define a class using the `class` keyword, `const_added` runs before
|
|
512
|
+
# `inherited`:
|
|
513
|
+
#
|
|
514
|
+
# module M
|
|
515
|
+
# def self.const_added(const_name)
|
|
516
|
+
# super
|
|
517
|
+
# p :const_added
|
|
518
|
+
# end
|
|
519
|
+
#
|
|
520
|
+
# parent = Class.new do
|
|
521
|
+
# def self.inherited(subclass)
|
|
522
|
+
# super
|
|
523
|
+
# p :inherited
|
|
524
|
+
# end
|
|
525
|
+
# end
|
|
526
|
+
#
|
|
527
|
+
# class Child < parent
|
|
528
|
+
# end
|
|
529
|
+
# end
|
|
530
|
+
#
|
|
531
|
+
# <em>produces:</em>
|
|
532
|
+
#
|
|
533
|
+
# :const_added
|
|
534
|
+
# :inherited
|
|
535
|
+
#
|
|
536
|
+
private def const_added: (Symbol) -> void
|
|
491
537
|
|
|
492
538
|
# <!--
|
|
493
539
|
# rdoc-file=object.c
|
|
@@ -590,10 +636,11 @@ class Module < Object
|
|
|
590
636
|
#
|
|
591
637
|
# In the next example, when a reference is made to an undefined constant,
|
|
592
638
|
# `const_missing` attempts to load a file whose path is the lowercase version of
|
|
593
|
-
# the constant name (thus class `Fred` is assumed to be in file
|
|
594
|
-
# defined as a side-effect of loading the file, the
|
|
595
|
-
# stored in the constant. This implements an autoload
|
|
596
|
-
# Kernel#autoload and Module#autoload, though it differs in
|
|
639
|
+
# the constant name (thus class `Fred` is assumed to be in file
|
|
640
|
+
# <code>fred.rb</code>). If defined as a side-effect of loading the file, the
|
|
641
|
+
# method returns the value stored in the constant. This implements an autoload
|
|
642
|
+
# feature similar to Kernel#autoload and Module#autoload, though it differs in
|
|
643
|
+
# important ways.
|
|
597
644
|
#
|
|
598
645
|
# def Object.const_missing(name)
|
|
599
646
|
# @looked_for ||= {}
|
|
@@ -635,7 +682,8 @@ class Module < Object
|
|
|
635
682
|
# If the constant is found, but its source location can not be extracted
|
|
636
683
|
# (constant is defined in C code), empty array is returned.
|
|
637
684
|
#
|
|
638
|
-
# *inherit* specifies whether to lookup in
|
|
685
|
+
# *inherit* specifies whether to lookup in <code>mod.ancestors</code> (`true` by
|
|
686
|
+
# default).
|
|
639
687
|
#
|
|
640
688
|
# # test.rb:
|
|
641
689
|
# class A # line 1
|
|
@@ -724,7 +772,7 @@ class Module < Object
|
|
|
724
772
|
# a.create_method(:betty) { p self }
|
|
725
773
|
# a.betty
|
|
726
774
|
#
|
|
727
|
-
#
|
|
775
|
+
# <em>produces:</em>
|
|
728
776
|
#
|
|
729
777
|
# In Fred
|
|
730
778
|
# Charge it!
|
|
@@ -753,8 +801,6 @@ class Module < Object
|
|
|
753
801
|
#
|
|
754
802
|
def deprecate_constant: (*interned) -> self
|
|
755
803
|
|
|
756
|
-
def eql?: (untyped other) -> bool
|
|
757
|
-
|
|
758
804
|
def equal?: (untyped other) -> bool
|
|
759
805
|
|
|
760
806
|
# <!--
|
|
@@ -778,12 +824,12 @@ class Module < Object
|
|
|
778
824
|
# (s = Array.new).extend Picky # Call Object.extend
|
|
779
825
|
# (s = "quick brown fox").extend Picky
|
|
780
826
|
#
|
|
781
|
-
#
|
|
827
|
+
# <em>produces:</em>
|
|
782
828
|
#
|
|
783
829
|
# Picky added to Array
|
|
784
830
|
# Can't add Picky to a String
|
|
785
831
|
#
|
|
786
|
-
def extend_object: (untyped arg0) -> untyped
|
|
832
|
+
private def extend_object: (untyped arg0) -> untyped
|
|
787
833
|
|
|
788
834
|
# <!--
|
|
789
835
|
# rdoc-file=object.c
|
|
@@ -801,7 +847,7 @@ class Module < Object
|
|
|
801
847
|
# end
|
|
802
848
|
# # => prints "A extended in Enumerable"
|
|
803
849
|
#
|
|
804
|
-
def extended: (Module othermod) -> untyped
|
|
850
|
+
private def extended: (Module othermod) -> untyped
|
|
805
851
|
|
|
806
852
|
# <!--
|
|
807
853
|
# rdoc-file=object.c
|
|
@@ -846,8 +892,8 @@ class Module < Object
|
|
|
846
892
|
# - included(othermod)
|
|
847
893
|
# -->
|
|
848
894
|
# Callback invoked whenever the receiver is included in another module or class.
|
|
849
|
-
# This should be used in preference to
|
|
850
|
-
# wants to perform some action when a module is included in another.
|
|
895
|
+
# This should be used in preference to <code>Module.append_features</code> if
|
|
896
|
+
# your code wants to perform some action when a module is included in another.
|
|
851
897
|
#
|
|
852
898
|
# module A
|
|
853
899
|
# def A.included(mod)
|
|
@@ -859,7 +905,7 @@ class Module < Object
|
|
|
859
905
|
# end
|
|
860
906
|
# # => prints "A included in Enumerable"
|
|
861
907
|
#
|
|
862
|
-
def included: (Module othermod) -> untyped
|
|
908
|
+
private def included: (Module othermod) -> untyped
|
|
863
909
|
|
|
864
910
|
# <!--
|
|
865
911
|
# rdoc-file=object.c
|
|
@@ -937,7 +983,7 @@ class Module < Object
|
|
|
937
983
|
# interpreter = Interpreter.new
|
|
938
984
|
# interpreter.interpret('dave')
|
|
939
985
|
#
|
|
940
|
-
#
|
|
986
|
+
# <em>produces:</em>
|
|
941
987
|
#
|
|
942
988
|
# Hello there, Dave!
|
|
943
989
|
#
|
|
@@ -994,11 +1040,11 @@ class Module < Object
|
|
|
994
1040
|
# def some_instance_method() end
|
|
995
1041
|
# end
|
|
996
1042
|
#
|
|
997
|
-
#
|
|
1043
|
+
# <em>produces:</em>
|
|
998
1044
|
#
|
|
999
1045
|
# Adding :some_instance_method
|
|
1000
1046
|
#
|
|
1001
|
-
def method_added: (Symbol meth) -> untyped
|
|
1047
|
+
private def method_added: (Symbol meth) -> untyped
|
|
1002
1048
|
|
|
1003
1049
|
# <!--
|
|
1004
1050
|
# rdoc-file=vm_method.c
|
|
@@ -1055,11 +1101,36 @@ class Module < Object
|
|
|
1055
1101
|
# remove_method :some_instance_method
|
|
1056
1102
|
# end
|
|
1057
1103
|
#
|
|
1058
|
-
#
|
|
1104
|
+
# <em>produces:</em>
|
|
1059
1105
|
#
|
|
1060
1106
|
# Removing :some_instance_method
|
|
1061
1107
|
#
|
|
1062
|
-
def method_removed: (Symbol method_name) -> untyped
|
|
1108
|
+
private def method_removed: (Symbol method_name) -> untyped
|
|
1109
|
+
|
|
1110
|
+
# <!--
|
|
1111
|
+
# rdoc-file=object.c
|
|
1112
|
+
# - method_undefined(method_name)
|
|
1113
|
+
# -->
|
|
1114
|
+
# Invoked as a callback whenever an instance method is undefined from the
|
|
1115
|
+
# receiver.
|
|
1116
|
+
#
|
|
1117
|
+
# module Chatty
|
|
1118
|
+
# def self.method_undefined(method_name)
|
|
1119
|
+
# puts "Undefining #{method_name.inspect}"
|
|
1120
|
+
# end
|
|
1121
|
+
# def self.some_class_method() end
|
|
1122
|
+
# def some_instance_method() end
|
|
1123
|
+
# class << self
|
|
1124
|
+
# undef_method :some_class_method
|
|
1125
|
+
# end
|
|
1126
|
+
# undef_method :some_instance_method
|
|
1127
|
+
# end
|
|
1128
|
+
#
|
|
1129
|
+
# <em>produces:</em>
|
|
1130
|
+
#
|
|
1131
|
+
# Undefining :some_instance_method
|
|
1132
|
+
#
|
|
1133
|
+
private def method_undefined: (Symbol method_name) -> untyped
|
|
1063
1134
|
|
|
1064
1135
|
# <!--
|
|
1065
1136
|
# rdoc-file=vm_eval.c
|
|
@@ -1081,7 +1152,7 @@ class Module < Object
|
|
|
1081
1152
|
# puts Thing.new.hello()
|
|
1082
1153
|
# Thing.module_eval("invalid code", "dummy", 123)
|
|
1083
1154
|
#
|
|
1084
|
-
#
|
|
1155
|
+
# <em>produces:</em>
|
|
1085
1156
|
#
|
|
1086
1157
|
# Hello there!
|
|
1087
1158
|
# dummy:123:in `module_eval': undefined local variable
|
|
@@ -1107,7 +1178,7 @@ class Module < Object
|
|
|
1107
1178
|
# }
|
|
1108
1179
|
# puts Thing.new.hello()
|
|
1109
1180
|
#
|
|
1110
|
-
#
|
|
1181
|
+
# <em>produces:</em>
|
|
1111
1182
|
#
|
|
1112
1183
|
# Hello there!
|
|
1113
1184
|
#
|
|
@@ -1152,11 +1223,11 @@ class Module < Object
|
|
|
1152
1223
|
# Mod.one #=> "This is one"
|
|
1153
1224
|
# c.call_one #=> "This is the new one"
|
|
1154
1225
|
#
|
|
1155
|
-
def module_function: () -> nil
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1226
|
+
private def module_function: () -> nil
|
|
1227
|
+
| (Symbol method_name) -> Symbol
|
|
1228
|
+
| (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
|
|
1229
|
+
| (string method_name) -> string
|
|
1230
|
+
| (interned, interned, *interned method_name) -> Array[interned]
|
|
1160
1231
|
|
|
1161
1232
|
# <!--
|
|
1162
1233
|
# rdoc-file=object.c
|
|
@@ -1184,7 +1255,7 @@ class Module < Object
|
|
|
1184
1255
|
# this module to *mod* if this module has not already been added to *mod* or one
|
|
1185
1256
|
# of its ancestors. See also Module#prepend.
|
|
1186
1257
|
#
|
|
1187
|
-
def prepend_features: (Module arg0) -> self
|
|
1258
|
+
private def prepend_features: (Module arg0) -> self
|
|
1188
1259
|
|
|
1189
1260
|
# <!--
|
|
1190
1261
|
# rdoc-file=object.c
|
|
@@ -1202,7 +1273,7 @@ class Module < Object
|
|
|
1202
1273
|
# end
|
|
1203
1274
|
# # => prints "A prepended to Enumerable"
|
|
1204
1275
|
#
|
|
1205
|
-
def prepended: (Module othermod) -> untyped
|
|
1276
|
+
private def prepended: (Module othermod) -> untyped
|
|
1206
1277
|
|
|
1207
1278
|
# <!--
|
|
1208
1279
|
# rdoc-file=vm_method.c
|
|
@@ -1227,14 +1298,14 @@ class Module < Object
|
|
|
1227
1298
|
# end
|
|
1228
1299
|
# Mod.private_instance_methods #=> [:a, :c]
|
|
1229
1300
|
#
|
|
1230
|
-
# Note that to show a private method on RDoc, use
|
|
1301
|
+
# Note that to show a private method on RDoc, use <code>:doc:</code>.
|
|
1231
1302
|
#
|
|
1232
|
-
def private: () -> nil
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1303
|
+
private def private: () -> nil
|
|
1304
|
+
| (Symbol method_name) -> Symbol
|
|
1305
|
+
| (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
|
|
1306
|
+
| (string method_name) -> string
|
|
1307
|
+
| (interned, interned, *interned method_name) -> Array[interned]
|
|
1308
|
+
| (Array[interned]) -> Array[interned]
|
|
1238
1309
|
|
|
1239
1310
|
# <!--
|
|
1240
1311
|
# rdoc-file=vm_method.c
|
|
@@ -1321,28 +1392,61 @@ class Module < Object
|
|
|
1321
1392
|
# - protected(method_name, method_name, ...) -> array
|
|
1322
1393
|
# - protected(array) -> array
|
|
1323
1394
|
# -->
|
|
1324
|
-
#
|
|
1325
|
-
#
|
|
1326
|
-
#
|
|
1327
|
-
#
|
|
1328
|
-
#
|
|
1329
|
-
#
|
|
1395
|
+
# Sets the visibility of a section or of a list of method names as protected.
|
|
1396
|
+
# Accepts no arguments, a splat of method names (symbols or strings) or an array
|
|
1397
|
+
# of method names. Returns the arguments that it received.
|
|
1398
|
+
#
|
|
1399
|
+
# ## Important difference between protected in other languages
|
|
1400
|
+
#
|
|
1401
|
+
# Protected methods in Ruby are different from other languages such as Java,
|
|
1402
|
+
# where methods are marked as protected to give access to subclasses. In Ruby,
|
|
1403
|
+
# subclasses **already have access to all methods defined in the parent class**,
|
|
1404
|
+
# even private ones.
|
|
1405
|
+
#
|
|
1406
|
+
# Marking a method as protected allows **different objects of the same class**
|
|
1407
|
+
# to call it.
|
|
1408
|
+
#
|
|
1409
|
+
# One use case is for comparison methods, such as <code>==</code>, if we want to
|
|
1410
|
+
# expose a method for comparison between objects of the same class without
|
|
1411
|
+
# making the method public to objects of other classes.
|
|
1412
|
+
#
|
|
1413
|
+
# ## Performance considerations
|
|
1330
1414
|
#
|
|
1331
|
-
#
|
|
1332
|
-
# context is the same as the method. (method definition or instance_eval). This
|
|
1333
|
-
# behavior is different from Java's protected method. Usually `private` should
|
|
1334
|
-
# be used.
|
|
1415
|
+
# Protected methods are slower than others because they can't use inline cache.
|
|
1335
1416
|
#
|
|
1336
|
-
#
|
|
1417
|
+
# ## Example
|
|
1337
1418
|
#
|
|
1338
|
-
#
|
|
1419
|
+
# class Account
|
|
1420
|
+
# # Mark balance as protected, so that we can compare between accounts
|
|
1421
|
+
# # without making it public.
|
|
1422
|
+
# attr_reader :balance
|
|
1423
|
+
# protected :balance
|
|
1339
1424
|
#
|
|
1340
|
-
def
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1425
|
+
# def initialize(balance)
|
|
1426
|
+
# @balance = balance
|
|
1427
|
+
# end
|
|
1428
|
+
#
|
|
1429
|
+
# def >(other)
|
|
1430
|
+
# # The invocation to `other.balance` is allowed because `other` is a
|
|
1431
|
+
# # different object of the same class (Account).
|
|
1432
|
+
# balance > other.balance
|
|
1433
|
+
# end
|
|
1434
|
+
# end
|
|
1435
|
+
#
|
|
1436
|
+
# account1 = Account.new(100)
|
|
1437
|
+
# account2 = Account.new(50)
|
|
1438
|
+
#
|
|
1439
|
+
# account1 > account2 # => true (works)
|
|
1440
|
+
# account1.balance # => NoMethodError (fails because balance is not public)
|
|
1441
|
+
#
|
|
1442
|
+
# To show a private method on RDoc, use <code>:doc:</code> instead of this.
|
|
1443
|
+
#
|
|
1444
|
+
private def protected: () -> nil
|
|
1445
|
+
| (Symbol method_name) -> Symbol
|
|
1446
|
+
| (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
|
|
1447
|
+
| (string method_name) -> string
|
|
1448
|
+
| (interned, interned, *interned method_name) -> Array[interned]
|
|
1449
|
+
| (Array[interned]) -> Array[interned]
|
|
1346
1450
|
|
|
1347
1451
|
# <!--
|
|
1348
1452
|
# rdoc-file=object.c
|
|
@@ -1397,12 +1501,12 @@ class Module < Object
|
|
|
1397
1501
|
# returned. If no argument is passed, nil is returned. If multiple arguments are
|
|
1398
1502
|
# passed, the arguments are returned as an array.
|
|
1399
1503
|
#
|
|
1400
|
-
def public: () -> nil
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1504
|
+
private def public: () -> nil
|
|
1505
|
+
| (Symbol method_name) -> Symbol
|
|
1506
|
+
| (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
|
|
1507
|
+
| (string method_name) -> string
|
|
1508
|
+
| (interned, interned, *interned method_name) -> Array[interned]
|
|
1509
|
+
| (Array[interned]) -> Array[interned]
|
|
1406
1510
|
|
|
1407
1511
|
# <!--
|
|
1408
1512
|
# rdoc-file=vm_method.c
|
|
@@ -1481,7 +1585,7 @@ class Module < Object
|
|
|
1481
1585
|
#
|
|
1482
1586
|
# Returns a module, where refined methods are defined.
|
|
1483
1587
|
#
|
|
1484
|
-
def refine: (Module mod) { () [self: Refinement] -> void } -> Refinement
|
|
1588
|
+
private def refine: (Module mod) { () [self: Refinement] -> void } -> Refinement
|
|
1485
1589
|
|
|
1486
1590
|
# <!--
|
|
1487
1591
|
# rdoc-file=eval.c
|
|
@@ -1499,7 +1603,7 @@ class Module < Object
|
|
|
1499
1603
|
#
|
|
1500
1604
|
# p A.refinements
|
|
1501
1605
|
#
|
|
1502
|
-
#
|
|
1606
|
+
# <em>produces:</em>
|
|
1503
1607
|
#
|
|
1504
1608
|
# [#<refinement:Integer@A>, #<refinement:String@A>]
|
|
1505
1609
|
#
|
|
@@ -1518,7 +1622,7 @@ class Module < Object
|
|
|
1518
1622
|
# p(defined? @@var)
|
|
1519
1623
|
# end
|
|
1520
1624
|
#
|
|
1521
|
-
#
|
|
1625
|
+
# <em>produces:</em>
|
|
1522
1626
|
#
|
|
1523
1627
|
# 99
|
|
1524
1628
|
# nil
|
|
@@ -1533,7 +1637,7 @@ class Module < Object
|
|
|
1533
1637
|
# previous value. If that constant referred to a module, this will not change
|
|
1534
1638
|
# that module's name and can lead to confusion.
|
|
1535
1639
|
#
|
|
1536
|
-
def remove_const: (interned arg0) -> untyped
|
|
1640
|
+
private def remove_const: (interned arg0) -> untyped
|
|
1537
1641
|
|
|
1538
1642
|
# <!--
|
|
1539
1643
|
# rdoc-file=vm_method.c
|
|
@@ -1545,6 +1649,43 @@ class Module < Object
|
|
|
1545
1649
|
#
|
|
1546
1650
|
def remove_method: (*interned arg0) -> self
|
|
1547
1651
|
|
|
1652
|
+
# <!--
|
|
1653
|
+
# rdoc-file=vm_method.c
|
|
1654
|
+
# - ruby2_keywords(method_name, ...) -> nil
|
|
1655
|
+
# -->
|
|
1656
|
+
# For the given method names, marks the method as passing keywords through a
|
|
1657
|
+
# normal argument splat. This should only be called on methods that accept an
|
|
1658
|
+
# argument splat (<code>*args</code>) but not explicit keywords or a keyword
|
|
1659
|
+
# splat. It marks the method such that if the method is called with keyword
|
|
1660
|
+
# arguments, the final hash argument is marked with a special flag such that if
|
|
1661
|
+
# it is the final element of a normal argument splat to another method call, and
|
|
1662
|
+
# that method call does not include explicit keywords or a keyword splat, the
|
|
1663
|
+
# final element is interpreted as keywords. In other words, keywords will be
|
|
1664
|
+
# passed through the method to other methods.
|
|
1665
|
+
#
|
|
1666
|
+
# This should only be used for methods that delegate keywords to another method,
|
|
1667
|
+
# and only for backwards compatibility with Ruby versions before 3.0. See
|
|
1668
|
+
# https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyw
|
|
1669
|
+
# ord-arguments-in-ruby-3-0/ for details on why `ruby2_keywords` exists and when
|
|
1670
|
+
# and how to use it.
|
|
1671
|
+
#
|
|
1672
|
+
# This method will probably be removed at some point, as it exists only for
|
|
1673
|
+
# backwards compatibility. As it does not exist in Ruby versions before 2.7,
|
|
1674
|
+
# check that the module responds to this method before calling it:
|
|
1675
|
+
#
|
|
1676
|
+
# module Mod
|
|
1677
|
+
# def foo(meth, *args, &block)
|
|
1678
|
+
# send(:"do_#{meth}", *args, &block)
|
|
1679
|
+
# end
|
|
1680
|
+
# ruby2_keywords(:foo) if respond_to?(:ruby2_keywords, true)
|
|
1681
|
+
# end
|
|
1682
|
+
#
|
|
1683
|
+
# However, be aware that if the `ruby2_keywords` method is removed, the behavior
|
|
1684
|
+
# of the `foo` method using the above approach will change so that the method
|
|
1685
|
+
# does not pass through keywords.
|
|
1686
|
+
#
|
|
1687
|
+
private def ruby2_keywords: (*interned method_name) -> nil
|
|
1688
|
+
|
|
1548
1689
|
# <!--
|
|
1549
1690
|
# rdoc-file=object.c
|
|
1550
1691
|
# - mod.set_temporary_name(string) -> self
|
|
@@ -1578,7 +1719,7 @@ class Module < Object
|
|
|
1578
1719
|
# m.name #=> nil
|
|
1579
1720
|
#
|
|
1580
1721
|
# c = Class.new
|
|
1581
|
-
# c.set_temporary_name("MyClass(with description)")
|
|
1722
|
+
# c.set_temporary_name("MyClass(with description)") # => MyClass(with description)
|
|
1582
1723
|
#
|
|
1583
1724
|
# c.new # => #<MyClass(with description):0x0....>
|
|
1584
1725
|
#
|
|
@@ -1652,7 +1793,7 @@ class Module < Object
|
|
|
1652
1793
|
# end
|
|
1653
1794
|
# c.hello
|
|
1654
1795
|
#
|
|
1655
|
-
#
|
|
1796
|
+
# <em>produces:</em>
|
|
1656
1797
|
#
|
|
1657
1798
|
# In child
|
|
1658
1799
|
# In parent
|
|
@@ -1676,7 +1817,7 @@ class Module < Object
|
|
|
1676
1817
|
# Import class refinements from *module* into the current class or module
|
|
1677
1818
|
# definition.
|
|
1678
1819
|
#
|
|
1679
|
-
def using: (Module arg0) -> self
|
|
1820
|
+
private def using: (Module arg0) -> self
|
|
1680
1821
|
|
|
1681
1822
|
# <!-- rdoc-file=object.c -->
|
|
1682
1823
|
# Returns a string representing this module or class. For basic classes and
|
|
@@ -1692,13 +1833,10 @@ class Module < Object
|
|
|
1692
1833
|
# - attr(name, false) -> array
|
|
1693
1834
|
# -->
|
|
1694
1835
|
# The first form is equivalent to #attr_reader. The second form is equivalent to
|
|
1695
|
-
#
|
|
1696
|
-
#
|
|
1697
|
-
# as symbols.
|
|
1836
|
+
# <code>attr_accessor(name)</code> but deprecated. The last form is equivalent
|
|
1837
|
+
# to <code>attr_reader(name)</code> but deprecated. Returns an array of defined
|
|
1838
|
+
# method names as symbols.
|
|
1698
1839
|
#
|
|
1699
|
-
def attr: (
|
|
1700
|
-
|
|
1701
|
-
# A previous incarnation of `interned` for backward-compatibility (see #1499)
|
|
1702
|
-
%a{deprecated: Use `interned`}
|
|
1703
|
-
type id = interned
|
|
1840
|
+
def attr: %a{deprecated} (interned, bool) -> Array[Symbol]
|
|
1841
|
+
| (*interned arg0) -> Array[Symbol]
|
|
1704
1842
|
end
|