rbs 4.0.0.dev.5 → 4.0.1.dev.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/.clang-format +1 -0
- data/.github/workflows/c-check.yml +8 -4
- data/.github/workflows/comments.yml +3 -1
- data/.github/workflows/dependabot.yml +1 -1
- data/.github/workflows/ruby.yml +10 -0
- data/.github/workflows/rust.yml +95 -0
- data/CHANGELOG.md +323 -0
- data/Rakefile +12 -29
- data/Steepfile +1 -0
- data/config.yml +393 -37
- data/core/array.rbs +218 -188
- data/core/basic_object.rbs +9 -8
- data/core/class.rbs +6 -5
- data/core/comparable.rbs +45 -31
- data/core/complex.rbs +52 -40
- data/core/dir.rbs +57 -45
- data/core/encoding.rbs +5 -5
- data/core/enumerable.rbs +96 -91
- data/core/enumerator.rbs +4 -3
- data/core/errno.rbs +3 -2
- data/core/errors.rbs +31 -29
- data/core/exception.rbs +12 -12
- data/core/fiber.rbs +36 -36
- data/core/file.rbs +186 -113
- data/core/file_test.rbs +2 -2
- data/core/float.rbs +41 -32
- data/core/gc.rbs +78 -70
- data/core/hash.rbs +70 -60
- data/core/integer.rbs +32 -28
- data/core/io/buffer.rbs +36 -36
- data/core/io/wait.rbs +7 -7
- data/core/io.rbs +120 -135
- data/core/kernel.rbs +189 -139
- data/core/marshal.rbs +3 -3
- data/core/match_data.rbs +14 -12
- data/core/math.rbs +69 -67
- data/core/method.rbs +6 -6
- data/core/module.rbs +146 -85
- data/core/nil_class.rbs +4 -3
- data/core/numeric.rbs +35 -32
- data/core/object.rbs +6 -8
- data/core/object_space.rbs +11 -10
- data/core/pathname.rbs +131 -81
- data/core/proc.rbs +65 -33
- data/core/process.rbs +219 -201
- data/core/ractor.rbs +15 -11
- data/core/random.rbs +4 -3
- data/core/range.rbs +52 -47
- data/core/rational.rbs +5 -5
- data/core/rbs/unnamed/argf.rbs +58 -51
- data/core/rbs/unnamed/env_class.rbs +18 -13
- data/core/rbs/unnamed/main_class.rbs +123 -0
- data/core/rbs/unnamed/random.rbs +7 -5
- data/core/regexp.rbs +236 -197
- data/core/ruby.rbs +1 -1
- data/core/ruby_vm.rbs +32 -30
- data/core/rubygems/config_file.rbs +5 -5
- data/core/rubygems/errors.rbs +1 -1
- data/core/rubygems/requirement.rbs +5 -5
- data/core/rubygems/rubygems.rbs +5 -3
- data/core/set.rbs +17 -16
- data/core/signal.rbs +2 -2
- data/core/string.rbs +311 -292
- data/core/struct.rbs +26 -25
- data/core/symbol.rbs +25 -24
- data/core/thread.rbs +40 -34
- data/core/time.rbs +47 -42
- data/core/trace_point.rbs +34 -31
- data/core/true_class.rbs +2 -2
- data/core/unbound_method.rbs +10 -10
- data/core/warning.rbs +7 -7
- data/docs/collection.md +1 -1
- data/docs/config.md +171 -0
- data/docs/inline.md +110 -4
- data/docs/syntax.md +13 -12
- data/ext/rbs_extension/ast_translation.c +489 -135
- data/ext/rbs_extension/class_constants.c +8 -0
- data/ext/rbs_extension/class_constants.h +4 -0
- data/ext/rbs_extension/legacy_location.c +28 -51
- data/ext/rbs_extension/legacy_location.h +37 -0
- data/ext/rbs_extension/main.c +12 -20
- data/include/rbs/ast.h +423 -195
- data/include/rbs/lexer.h +2 -2
- data/include/rbs/location.h +25 -44
- data/include/rbs/parser.h +2 -2
- data/include/rbs/util/rbs_constant_pool.h +0 -3
- data/include/rbs.h +8 -0
- data/lib/rbs/ast/ruby/annotations.rb +157 -4
- data/lib/rbs/ast/ruby/members.rb +374 -22
- data/lib/rbs/cli/validate.rb +5 -60
- data/lib/rbs/collection/config/lockfile_generator.rb +6 -2
- data/lib/rbs/definition_builder.rb +60 -27
- data/lib/rbs/errors.rb +0 -11
- data/lib/rbs/inline_parser.rb +1 -1
- data/lib/rbs/parser_aux.rb +20 -7
- data/lib/rbs/prototype/helpers.rb +57 -0
- data/lib/rbs/prototype/rb.rb +1 -26
- data/lib/rbs/prototype/rbi.rb +1 -20
- data/lib/rbs/test/type_check.rb +3 -0
- data/lib/rbs/types.rb +62 -52
- data/lib/rbs/unit_test/type_assertions.rb +35 -8
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +0 -1
- data/rbs.gemspec +1 -1
- 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/sig/ast/ruby/annotations.rbs +191 -4
- data/sig/ast/ruby/members.rbs +21 -1
- data/sig/cli/validate.rbs +1 -6
- data/sig/definition_builder.rbs +2 -0
- data/sig/errors.rbs +0 -8
- data/sig/method_types.rbs +1 -1
- data/sig/parser.rbs +17 -13
- data/sig/prototype/helpers.rbs +2 -0
- data/sig/types.rbs +10 -11
- data/sig/unit_test/spy.rbs +0 -8
- data/sig/unit_test/type_assertions.rbs +11 -0
- data/src/ast.c +339 -161
- data/src/lexstate.c +1 -1
- data/src/location.c +7 -47
- data/src/parser.c +674 -480
- data/src/util/rbs_constant_pool.c +0 -4
- data/stdlib/bigdecimal/0/big_decimal.rbs +16 -16
- data/stdlib/cgi-escape/0/escape.rbs +4 -4
- data/stdlib/coverage/0/coverage.rbs +4 -3
- data/stdlib/date/0/date.rbs +33 -28
- data/stdlib/date/0/date_time.rbs +24 -23
- data/stdlib/did_you_mean/0/did_you_mean.rbs +17 -16
- data/stdlib/erb/0/erb.rbs +64 -53
- data/stdlib/etc/0/etc.rbs +55 -50
- data/stdlib/fileutils/0/fileutils.rbs +138 -125
- data/stdlib/forwardable/0/forwardable.rbs +10 -10
- data/stdlib/io-console/0/io-console.rbs +2 -2
- data/stdlib/json/0/json.rbs +135 -108
- data/stdlib/monitor/0/monitor.rbs +3 -3
- data/stdlib/net-http/0/net-http.rbs +159 -134
- data/stdlib/objspace/0/objspace.rbs +8 -7
- data/stdlib/open-uri/0/open-uri.rbs +8 -8
- data/stdlib/open3/0/open3.rbs +36 -35
- data/stdlib/openssl/0/openssl.rbs +144 -129
- data/stdlib/optparse/0/optparse.rbs +18 -14
- data/stdlib/pathname/0/pathname.rbs +2 -2
- 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 +61 -8
- data/stdlib/psych/0/store.rbs +2 -4
- data/stdlib/pty/0/pty.rbs +9 -6
- data/stdlib/random-formatter/0/random-formatter.rbs +2 -2
- data/stdlib/ripper/0/ripper.rbs +20 -17
- data/stdlib/securerandom/0/securerandom.rbs +1 -1
- data/stdlib/shellwords/0/shellwords.rbs +2 -2
- 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 +10 -9
- data/stdlib/socket/0/tcp_server.rbs +1 -1
- data/stdlib/socket/0/tcp_socket.rbs +1 -1
- data/stdlib/socket/0/udp_socket.rbs +1 -1
- data/stdlib/socket/0/unix_server.rbs +1 -1
- data/stdlib/stringio/0/stringio.rbs +55 -54
- data/stdlib/strscan/0/string_scanner.rbs +46 -44
- data/stdlib/tempfile/0/tempfile.rbs +24 -20
- data/stdlib/time/0/time.rbs +7 -5
- data/stdlib/tsort/0/tsort.rbs +7 -6
- data/stdlib/uri/0/common.rbs +26 -18
- data/stdlib/uri/0/file.rbs +2 -2
- data/stdlib/uri/0/generic.rbs +2 -2
- 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 +6 -5
- data/stdlib/zlib/0/deflate.rbs +4 -3
- data/stdlib/zlib/0/gzip_reader.rbs +4 -4
- 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
- metadata +23 -5
- data/.github/workflows/valgrind.yml +0 -42
data/core/marshal.rbs
CHANGED
|
@@ -167,9 +167,9 @@ module Marshal
|
|
|
167
167
|
# Never pass untrusted data (including user supplied input) to this method.
|
|
168
168
|
# Please see the overview for further details.
|
|
169
169
|
#
|
|
170
|
-
# If the
|
|
171
|
-
# frozen. Note that it may lead to more efficient memory usage due to
|
|
172
|
-
# strings deduplication:
|
|
170
|
+
# If the <code>freeze: true</code> argument is passed, deserialized object would
|
|
171
|
+
# be deeply frozen. Note that it may lead to more efficient memory usage due to
|
|
172
|
+
# frozen strings deduplication:
|
|
173
173
|
#
|
|
174
174
|
# serialized = Marshal.dump(['value1', 'value2', 'value1', 'value2'])
|
|
175
175
|
#
|
data/core/match_data.rbs
CHANGED
|
@@ -34,12 +34,14 @@
|
|
|
34
34
|
# Parts of last MatchData (returned by Regexp.last_match) are also aliased as
|
|
35
35
|
# global variables:
|
|
36
36
|
#
|
|
37
|
-
# *
|
|
38
|
-
# *
|
|
39
|
-
# *
|
|
40
|
-
#
|
|
41
|
-
# *
|
|
42
|
-
# *
|
|
37
|
+
# * <code>$~</code> is Regexp.last_match;
|
|
38
|
+
# * <code>$&</code> is Regexp.last_match<code>[ 0 ]</code>;
|
|
39
|
+
# * <code>$1</code>, <code>$2</code>, and so on are Regexp.last_match<code>[ i
|
|
40
|
+
# ]</code> (captures by number);
|
|
41
|
+
# * <code>$`</code> is Regexp.last_match<code>.pre_match</code>;
|
|
42
|
+
# * <code>$'</code> is Regexp.last_match<code>.post_match</code>;
|
|
43
|
+
# * <code>$+</code> is Regexp.last_match<code>[ -1 ]</code> (the last
|
|
44
|
+
# capture).
|
|
43
45
|
#
|
|
44
46
|
# See also Regexp@Global+Variables.
|
|
45
47
|
#
|
|
@@ -230,7 +232,7 @@ class MatchData
|
|
|
230
232
|
# rdoc-file=re.c
|
|
231
233
|
# - captures -> array
|
|
232
234
|
# -->
|
|
233
|
-
# Returns the array of captures, which are all matches except
|
|
235
|
+
# Returns the array of captures, which are all matches except <code>m[0]</code>:
|
|
234
236
|
#
|
|
235
237
|
# m = /(.)(.)(\d+)(\d)/.match("THX1138.")
|
|
236
238
|
# # => #<MatchData "HX1138" 1:"H" 2:"X" 3:"113" 4:"8">
|
|
@@ -242,7 +244,7 @@ class MatchData
|
|
|
242
244
|
def captures: () -> Array[String?]
|
|
243
245
|
|
|
244
246
|
# <!-- rdoc-file=re.c -->
|
|
245
|
-
# Returns the array of captures, which are all matches except
|
|
247
|
+
# Returns the array of captures, which are all matches except <code>m[0]</code>:
|
|
246
248
|
#
|
|
247
249
|
# m = /(.)(.)(\d+)(\d)/.match("THX1138.")
|
|
248
250
|
# # => #<MatchData "HX1138" 1:"H" 2:"X" 3:"113" 4:"8">
|
|
@@ -511,8 +513,8 @@ class MatchData
|
|
|
511
513
|
# - post_match -> str
|
|
512
514
|
# -->
|
|
513
515
|
# Returns the substring of the target string from the end of the first match in
|
|
514
|
-
# `self` (that is,
|
|
515
|
-
# global variable
|
|
516
|
+
# `self` (that is, <code>self[0]</code>) to the end of the string; equivalent to
|
|
517
|
+
# regexp global variable <code>$'</code>:
|
|
516
518
|
#
|
|
517
519
|
# m = /(.)(.)(\d+)(\d)/.match("THX1138: The Movie")
|
|
518
520
|
# # => #<MatchData "HX1138" 1:"H" 2:"X" 3:"113" 4:"8">
|
|
@@ -528,8 +530,8 @@ class MatchData
|
|
|
528
530
|
# - pre_match -> string
|
|
529
531
|
# -->
|
|
530
532
|
# Returns the substring of the target string from its beginning up to the first
|
|
531
|
-
# match in `self` (that is,
|
|
532
|
-
#
|
|
533
|
+
# match in `self` (that is, <code>self[0]</code>); equivalent to regexp global
|
|
534
|
+
# variable <code>$`</code>:
|
|
533
535
|
#
|
|
534
536
|
# m = /(.)(.)(\d+)(\d)/.match("THX1138.")
|
|
535
537
|
# # => #<MatchData "HX1138" 1:"H" 2:"X" 3:"113" 4:"8">
|
data/core/math.rbs
CHANGED
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
# because many such values are, in mathematics, of infinite precision, while in
|
|
42
42
|
# numerical computation the precision is finite.
|
|
43
43
|
#
|
|
44
|
-
# Thus, in mathematics,
|
|
45
|
-
#
|
|
44
|
+
# Thus, in mathematics, <em>cos(π/2)</em> is exactly zero, but in our
|
|
45
|
+
# computation <code>cos(PI/2)</code> is a number very close to zero:
|
|
46
46
|
#
|
|
47
47
|
# cos(PI/2) # => 6.123031769111886e-17
|
|
48
48
|
#
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
#
|
|
115
115
|
# #### Hypotenuse Function
|
|
116
116
|
#
|
|
117
|
-
# * ::hypot: Returns
|
|
117
|
+
# * ::hypot: Returns <code>sqrt(a**2 + b**2)</code> for the given `a` and `b`.
|
|
118
118
|
#
|
|
119
119
|
module Math
|
|
120
120
|
# <!-- rdoc-file=math.c -->
|
|
@@ -137,7 +137,7 @@ module Math
|
|
|
137
137
|
#
|
|
138
138
|
# Math.acos(42)
|
|
139
139
|
#
|
|
140
|
-
#
|
|
140
|
+
# <em>produces:</em>
|
|
141
141
|
#
|
|
142
142
|
# Math::DomainError: Numerical argument is out of domain - "acos"
|
|
143
143
|
#
|
|
@@ -155,8 +155,8 @@ module Math
|
|
|
155
155
|
# Returns the [arc
|
|
156
156
|
# cosine](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions) of `x`.
|
|
157
157
|
#
|
|
158
|
-
# * Domain:
|
|
159
|
-
# * Range:
|
|
158
|
+
# * Domain: <code>[-1, 1]</code>.
|
|
159
|
+
# * Range: <code>[0, PI]</code>.
|
|
160
160
|
#
|
|
161
161
|
# Examples:
|
|
162
162
|
#
|
|
@@ -173,8 +173,8 @@ module Math
|
|
|
173
173
|
# Returns the [inverse hyperbolic
|
|
174
174
|
# cosine](https://en.wikipedia.org/wiki/Inverse_hyperbolic_functions) of `x`.
|
|
175
175
|
#
|
|
176
|
-
# * Domain:
|
|
177
|
-
# * Range:
|
|
176
|
+
# * Domain: <code>[1, INFINITY]</code>.
|
|
177
|
+
# * Range: <code>[0, INFINITY]</code>.
|
|
178
178
|
#
|
|
179
179
|
# Examples:
|
|
180
180
|
#
|
|
@@ -190,8 +190,8 @@ module Math
|
|
|
190
190
|
# Returns the [arc
|
|
191
191
|
# sine](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions) of `x`.
|
|
192
192
|
#
|
|
193
|
-
# * Domain:
|
|
194
|
-
# * Range:
|
|
193
|
+
# * Domain: <code>[-1, -1]</code>.
|
|
194
|
+
# * Range: <code>[-PI/2, PI/2]</code>.
|
|
195
195
|
#
|
|
196
196
|
# Examples:
|
|
197
197
|
#
|
|
@@ -208,8 +208,8 @@ module Math
|
|
|
208
208
|
# Returns the [inverse hyperbolic
|
|
209
209
|
# sine](https://en.wikipedia.org/wiki/Inverse_hyperbolic_functions) of `x`.
|
|
210
210
|
#
|
|
211
|
-
# * Domain:
|
|
212
|
-
# * Range:
|
|
211
|
+
# * Domain: <code>[-INFINITY, INFINITY]</code>.
|
|
212
|
+
# * Range: <code>[-INFINITY, INFINITY]</code>.
|
|
213
213
|
#
|
|
214
214
|
# Examples:
|
|
215
215
|
#
|
|
@@ -227,8 +227,8 @@ module Math
|
|
|
227
227
|
# tangent](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions) of
|
|
228
228
|
# `x`.
|
|
229
229
|
#
|
|
230
|
-
# * Domain:
|
|
231
|
-
# * Range:
|
|
230
|
+
# * Domain: <code>[-INFINITY, INFINITY]</code>.
|
|
231
|
+
# * Range: <code>[-PI/2, PI/2] </code>.
|
|
232
232
|
#
|
|
233
233
|
# Examples:
|
|
234
234
|
#
|
|
@@ -251,9 +251,9 @@ module Math
|
|
|
251
251
|
# [radians](https://en.wikipedia.org/wiki/Trigonometric_functions#Radians_versus
|
|
252
252
|
# _degrees).
|
|
253
253
|
#
|
|
254
|
-
# * Domain of `y`:
|
|
255
|
-
# * Domain of `x`:
|
|
256
|
-
# * Range:
|
|
254
|
+
# * Domain of `y`: <code>[-INFINITY, INFINITY]</code>.
|
|
255
|
+
# * Domain of `x`: <code>[-INFINITY, INFINITY]</code>.
|
|
256
|
+
# * Range: <code>[-PI, PI]</code>.
|
|
257
257
|
#
|
|
258
258
|
# Examples:
|
|
259
259
|
#
|
|
@@ -271,8 +271,8 @@ module Math
|
|
|
271
271
|
# Returns the [inverse hyperbolic
|
|
272
272
|
# tangent](https://en.wikipedia.org/wiki/Inverse_hyperbolic_functions) of `x`.
|
|
273
273
|
#
|
|
274
|
-
# * Domain:
|
|
275
|
-
# * Range:
|
|
274
|
+
# * Domain: <code>[-1, 1]</code>.
|
|
275
|
+
# * Range: <code>[-INFINITY, INFINITY]</code>.
|
|
276
276
|
#
|
|
277
277
|
# Examples:
|
|
278
278
|
#
|
|
@@ -288,8 +288,8 @@ module Math
|
|
|
288
288
|
# -->
|
|
289
289
|
# Returns the [cube root](https://en.wikipedia.org/wiki/Cube_root) of `x`.
|
|
290
290
|
#
|
|
291
|
-
# * Domain:
|
|
292
|
-
# * Range:
|
|
291
|
+
# * Domain: <code>[-INFINITY, INFINITY]</code>.
|
|
292
|
+
# * Range: <code>[-INFINITY, INFINITY]</code>.
|
|
293
293
|
#
|
|
294
294
|
# Examples:
|
|
295
295
|
#
|
|
@@ -315,8 +315,8 @@ module Math
|
|
|
315
315
|
# [radians](https://en.wikipedia.org/wiki/Trigonometric_functions#Radians_versus
|
|
316
316
|
# _degrees).
|
|
317
317
|
#
|
|
318
|
-
# * Domain:
|
|
319
|
-
# * Range:
|
|
318
|
+
# * Domain: <code>(-INFINITY, INFINITY)</code>.
|
|
319
|
+
# * Range: <code>[-1.0, 1.0]</code>.
|
|
320
320
|
#
|
|
321
321
|
# Examples:
|
|
322
322
|
#
|
|
@@ -337,8 +337,8 @@ module Math
|
|
|
337
337
|
# [radians](https://en.wikipedia.org/wiki/Trigonometric_functions#Radians_versus
|
|
338
338
|
# _degrees).
|
|
339
339
|
#
|
|
340
|
-
# * Domain:
|
|
341
|
-
# * Range:
|
|
340
|
+
# * Domain: <code>[-INFINITY, INFINITY]</code>.
|
|
341
|
+
# * Range: <code>[1, INFINITY]</code>.
|
|
342
342
|
#
|
|
343
343
|
# Examples:
|
|
344
344
|
#
|
|
@@ -355,8 +355,8 @@ module Math
|
|
|
355
355
|
# Returns the value of the [Gauss error
|
|
356
356
|
# function](https://en.wikipedia.org/wiki/Error_function) for `x`.
|
|
357
357
|
#
|
|
358
|
-
# * Domain:
|
|
359
|
-
# * Range:
|
|
358
|
+
# * Domain: <code>[-INFINITY, INFINITY]</code>.
|
|
359
|
+
# * Range: <code>[-1, 1]</code>.
|
|
360
360
|
#
|
|
361
361
|
# Examples:
|
|
362
362
|
#
|
|
@@ -376,8 +376,8 @@ module Math
|
|
|
376
376
|
# function](https://en.wikipedia.org/wiki/Error_function#Complementary_error_fun
|
|
377
377
|
# ction) for `x`.
|
|
378
378
|
#
|
|
379
|
-
# * Domain:
|
|
380
|
-
# * Range:
|
|
379
|
+
# * Domain: <code>[-INFINITY, INFINITY]</code>.
|
|
380
|
+
# * Range: <code>[0, 2]</code>.
|
|
381
381
|
#
|
|
382
382
|
# Examples:
|
|
383
383
|
#
|
|
@@ -395,8 +395,8 @@ module Math
|
|
|
395
395
|
# -->
|
|
396
396
|
# Returns `e` raised to the `x` power.
|
|
397
397
|
#
|
|
398
|
-
# * Domain:
|
|
399
|
-
# * Range:
|
|
398
|
+
# * Domain: <code>[-INFINITY, INFINITY]</code>.
|
|
399
|
+
# * Range: <code>[0, INFINITY]</code>.
|
|
400
400
|
#
|
|
401
401
|
# Examples:
|
|
402
402
|
#
|
|
@@ -416,8 +416,8 @@ module Math
|
|
|
416
416
|
# -->
|
|
417
417
|
# Returns "exp(x) - 1", `e` raised to the `x` power, minus 1.
|
|
418
418
|
#
|
|
419
|
-
# * Domain:
|
|
420
|
-
# * Range:
|
|
419
|
+
# * Domain: <code>[-INFINITY, INFINITY]</code>.
|
|
420
|
+
# * Range: <code>[-1.0, INFINITY]</code>.
|
|
421
421
|
#
|
|
422
422
|
# Examples:
|
|
423
423
|
#
|
|
@@ -444,8 +444,8 @@ module Math
|
|
|
444
444
|
# binary64](https://en.wikipedia.org/wiki/Double-precision_floating-point_format
|
|
445
445
|
# #IEEE_754_double-precision_binary_floating-point_format:_binary64).
|
|
446
446
|
#
|
|
447
|
-
# * Domain:
|
|
448
|
-
# * Range
|
|
447
|
+
# * Domain: <code>[-INFINITY, INFINITY]</code>.
|
|
448
|
+
# * Range <code>[-INFINITY, INFINITY]</code>.
|
|
449
449
|
#
|
|
450
450
|
# Examples:
|
|
451
451
|
#
|
|
@@ -468,8 +468,8 @@ module Math
|
|
|
468
468
|
# Returns the value of the [gamma
|
|
469
469
|
# function](https://en.wikipedia.org/wiki/Gamma_function) for `x`.
|
|
470
470
|
#
|
|
471
|
-
# * Domain:
|
|
472
|
-
# * Range:
|
|
471
|
+
# * Domain: <code>(-INFINITY, INFINITY]</code> excluding negative integers.
|
|
472
|
+
# * Range: <code>[-INFINITY, INFINITY]</code>.
|
|
473
473
|
#
|
|
474
474
|
# Examples:
|
|
475
475
|
#
|
|
@@ -491,12 +491,13 @@ module Math
|
|
|
491
491
|
# rdoc-file=math.c
|
|
492
492
|
# - Math.hypot(a, b) -> float
|
|
493
493
|
# -->
|
|
494
|
-
# Returns
|
|
495
|
-
# hypotenuse) of the right triangle whose other sides have lengths
|
|
494
|
+
# Returns <code>sqrt(a**2 + b**2)</code>, which is the length of the longest
|
|
495
|
+
# side `c` (the hypotenuse) of the right triangle whose other sides have lengths
|
|
496
|
+
# `a` and `b`.
|
|
496
497
|
#
|
|
497
|
-
# * Domain of `a`:
|
|
498
|
-
# * Domain of +ab:
|
|
499
|
-
# * Range:
|
|
498
|
+
# * Domain of `a`: <code>[-INFINITY, INFINITY]</code>.
|
|
499
|
+
# * Domain of +ab: <code>[-INFINITY, INFINITY]</code>.
|
|
500
|
+
# * Range: <code>[0, INFINITY]</code>.
|
|
500
501
|
#
|
|
501
502
|
# Examples:
|
|
502
503
|
#
|
|
@@ -506,8 +507,8 @@ module Math
|
|
|
506
507
|
# hypot(5.0, 12.0) # => 13.0
|
|
507
508
|
# hypot(1.0, sqrt(3.0)) # => 1.9999999999999998 # Near 2.0
|
|
508
509
|
#
|
|
509
|
-
# Note that if either argument is `INFINITY` or
|
|
510
|
-
# `Infinity`.
|
|
510
|
+
# Note that if either argument is `INFINITY` or <code>-INFINITY</code>, the
|
|
511
|
+
# result is `Infinity`.
|
|
511
512
|
#
|
|
512
513
|
def self.hypot: (double x, double y) -> Float
|
|
513
514
|
|
|
@@ -515,10 +516,11 @@ module Math
|
|
|
515
516
|
# rdoc-file=math.c
|
|
516
517
|
# - Math.ldexp(fraction, exponent) -> float
|
|
517
518
|
# -->
|
|
518
|
-
# Returns the value of
|
|
519
|
+
# Returns the value of <code>fraction * 2**exponent</code>.
|
|
519
520
|
#
|
|
520
|
-
# * Domain of `fraction`:
|
|
521
|
-
# * Domain of `exponent`:
|
|
521
|
+
# * Domain of `fraction`: <code>[0.0, 1.0)</code>.
|
|
522
|
+
# * Domain of `exponent`: <code>[0, 1024]</code> (larger values are equivalent
|
|
523
|
+
# to 1024).
|
|
522
524
|
#
|
|
523
525
|
# See [IEEE 754 double-precision binary floating-point format:
|
|
524
526
|
# binary64](https://en.wikipedia.org/wiki/Double-precision_floating-point_format
|
|
@@ -549,8 +551,8 @@ module Math
|
|
|
549
551
|
# See [log gamma
|
|
550
552
|
# function](https://en.wikipedia.org/wiki/Gamma_function#Log-gamma_function).
|
|
551
553
|
#
|
|
552
|
-
# * Domain:
|
|
553
|
-
# * Range of first element:
|
|
554
|
+
# * Domain: <code>(-INFINITY, INFINITY]</code>.
|
|
555
|
+
# * Range of first element: <code>(-INFINITY, INFINITY]</code>.
|
|
554
556
|
# * Second element is -1 or 1.
|
|
555
557
|
#
|
|
556
558
|
# Examples:
|
|
@@ -584,8 +586,8 @@ module Math
|
|
|
584
586
|
# Returns the base `base` [logarithm](https://en.wikipedia.org/wiki/Logarithm)
|
|
585
587
|
# of `x`.
|
|
586
588
|
#
|
|
587
|
-
# * Domain:
|
|
588
|
-
# * Range:
|
|
589
|
+
# * Domain: <code>[0, INFINITY]</code>.
|
|
590
|
+
# * Range: <code>[-INFINITY, INFINITY)]</code>.
|
|
589
591
|
#
|
|
590
592
|
# Examples:
|
|
591
593
|
#
|
|
@@ -611,8 +613,8 @@ module Math
|
|
|
611
613
|
# Returns the base 10 [logarithm](https://en.wikipedia.org/wiki/Logarithm) of
|
|
612
614
|
# `x`.
|
|
613
615
|
#
|
|
614
|
-
# * Domain:
|
|
615
|
-
# * Range:
|
|
616
|
+
# * Domain: <code>[0, INFINITY]</code>.
|
|
617
|
+
# * Range: <code>[-INFINITY, INFINITY]</code>.
|
|
616
618
|
#
|
|
617
619
|
# Examples:
|
|
618
620
|
#
|
|
@@ -630,8 +632,8 @@ module Math
|
|
|
630
632
|
# Returns "log(x + 1)", the base E
|
|
631
633
|
# [logarithm](https://en.wikipedia.org/wiki/Logarithm) of (`x` + 1).
|
|
632
634
|
#
|
|
633
|
-
# * Domain:
|
|
634
|
-
# * Range:
|
|
635
|
+
# * Domain: <code>[-1, INFINITY]</code>.
|
|
636
|
+
# * Range: <code>[-INFINITY, INFINITY]</code>.
|
|
635
637
|
#
|
|
636
638
|
# Examples:
|
|
637
639
|
#
|
|
@@ -649,8 +651,8 @@ module Math
|
|
|
649
651
|
# Returns the base 2 [logarithm](https://en.wikipedia.org/wiki/Logarithm) of
|
|
650
652
|
# `x`.
|
|
651
653
|
#
|
|
652
|
-
# * Domain:
|
|
653
|
-
# * Range:
|
|
654
|
+
# * Domain: <code>[0, INFINITY]</code>.
|
|
655
|
+
# * Range: <code>[-INFINITY, INFINITY]</code>.
|
|
654
656
|
#
|
|
655
657
|
# Examples:
|
|
656
658
|
#
|
|
@@ -669,8 +671,8 @@ module Math
|
|
|
669
671
|
# [radians](https://en.wikipedia.org/wiki/Trigonometric_functions#Radians_versus
|
|
670
672
|
# _degrees).
|
|
671
673
|
#
|
|
672
|
-
# * Domain:
|
|
673
|
-
# * Range:
|
|
674
|
+
# * Domain: <code>(-INFINITY, INFINITY)</code>.
|
|
675
|
+
# * Range: <code>[-1.0, 1.0]</code>.
|
|
674
676
|
#
|
|
675
677
|
# Examples:
|
|
676
678
|
#
|
|
@@ -691,8 +693,8 @@ module Math
|
|
|
691
693
|
# [radians](https://en.wikipedia.org/wiki/Trigonometric_functions#Radians_versus
|
|
692
694
|
# _degrees).
|
|
693
695
|
#
|
|
694
|
-
# * Domain:
|
|
695
|
-
# * Range:
|
|
696
|
+
# * Domain: <code>[-INFINITY, INFINITY]</code>.
|
|
697
|
+
# * Range: <code>[-INFINITY, INFINITY]</code>.
|
|
696
698
|
#
|
|
697
699
|
# Examples:
|
|
698
700
|
#
|
|
@@ -709,8 +711,8 @@ module Math
|
|
|
709
711
|
# Returns the principal (non-negative) [square
|
|
710
712
|
# root](https://en.wikipedia.org/wiki/Square_root) of `x`.
|
|
711
713
|
#
|
|
712
|
-
# * Domain:
|
|
713
|
-
# * Range:
|
|
714
|
+
# * Domain: <code>[0, INFINITY]</code>.
|
|
715
|
+
# * Range: <code>[0, INFINITY]</code>.
|
|
714
716
|
#
|
|
715
717
|
# Examples:
|
|
716
718
|
#
|
|
@@ -733,8 +735,8 @@ module Math
|
|
|
733
735
|
# [radians](https://en.wikipedia.org/wiki/Trigonometric_functions#Radians_versus
|
|
734
736
|
# _degrees).
|
|
735
737
|
#
|
|
736
|
-
# * Domain:
|
|
737
|
-
# * Range:
|
|
738
|
+
# * Domain: <code>(-INFINITY, INFINITY)</code>.
|
|
739
|
+
# * Range: <code>(-INFINITY, INFINITY)</code>.
|
|
738
740
|
#
|
|
739
741
|
# Examples:
|
|
740
742
|
#
|
|
@@ -755,8 +757,8 @@ module Math
|
|
|
755
757
|
# [radians](https://en.wikipedia.org/wiki/Trigonometric_functions#Radians_versus
|
|
756
758
|
# _degrees).
|
|
757
759
|
#
|
|
758
|
-
# * Domain:
|
|
759
|
-
# * Range:
|
|
760
|
+
# * Domain: <code>[-INFINITY, INFINITY]</code>.
|
|
761
|
+
# * Range: <code>[-1, 1]</code>.
|
|
760
762
|
#
|
|
761
763
|
# Examples:
|
|
762
764
|
#
|
data/core/method.rbs
CHANGED
|
@@ -74,12 +74,12 @@ class Method
|
|
|
74
74
|
# Net::HTTP.method(:get).inspect
|
|
75
75
|
# #=> "#<Method: Net::HTTP.get(uri_or_host, path=..., port=...) <skip>/lib/ruby/2.7.0/net/http.rb:457>"
|
|
76
76
|
#
|
|
77
|
-
#
|
|
78
|
-
# value).
|
|
77
|
+
# <code>...</code> in argument definition means argument is optional (has some
|
|
78
|
+
# default value).
|
|
79
79
|
#
|
|
80
80
|
# For methods defined in C (language core and extensions), location and argument
|
|
81
81
|
# names can't be extracted, and only generic information is provided in form of
|
|
82
|
-
#
|
|
82
|
+
# <code>*</code> (any number of arguments) or `_` (some positional argument).
|
|
83
83
|
#
|
|
84
84
|
# "cat".method(:count).inspect #=> "#<Method: String#count(*)>"
|
|
85
85
|
# "cat".method(:+).inspect #=> "#<Method: String#+(_)>""
|
|
@@ -102,12 +102,12 @@ class Method
|
|
|
102
102
|
# Net::HTTP.method(:get).inspect
|
|
103
103
|
# #=> "#<Method: Net::HTTP.get(uri_or_host, path=..., port=...) <skip>/lib/ruby/2.7.0/net/http.rb:457>"
|
|
104
104
|
#
|
|
105
|
-
#
|
|
106
|
-
# value).
|
|
105
|
+
# <code>...</code> in argument definition means argument is optional (has some
|
|
106
|
+
# default value).
|
|
107
107
|
#
|
|
108
108
|
# For methods defined in C (language core and extensions), location and argument
|
|
109
109
|
# names can't be extracted, and only generic information is provided in form of
|
|
110
|
-
#
|
|
110
|
+
# <code>*</code> (any number of arguments) or `_` (some positional argument).
|
|
111
111
|
#
|
|
112
112
|
# "cat".method(:count).inspect #=> "#<Method: String#count(*)>"
|
|
113
113
|
# "cat".method(:+).inspect #=> "#<Method: String#+(_)>""
|