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
|
@@ -95,10 +95,6 @@ rbs_constant_pool_resize(rbs_constant_pool_t *pool) {
|
|
|
95
95
|
return true;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
// This storage is initialized by `Init_rbs_extension()` in `main.c`.
|
|
99
|
-
static rbs_constant_pool_t RBS_GLOBAL_CONSTANT_POOL_STORAGE = { 0 };
|
|
100
|
-
rbs_constant_pool_t *RBS_GLOBAL_CONSTANT_POOL = &RBS_GLOBAL_CONSTANT_POOL_STORAGE;
|
|
101
|
-
|
|
102
98
|
/**
|
|
103
99
|
* Initialize a new constant pool with a given capacity.
|
|
104
100
|
*/
|
|
@@ -1278,7 +1278,7 @@ class Integer
|
|
|
1278
1278
|
# 4 / Complex(3, 0) # => ((4/3)+0i)
|
|
1279
1279
|
#
|
|
1280
1280
|
def /: (BigDecimal) -> BigDecimal
|
|
1281
|
-
|
|
1281
|
+
| ...
|
|
1282
1282
|
|
|
1283
1283
|
# <!--
|
|
1284
1284
|
# rdoc-file=numeric.c
|
|
@@ -1294,7 +1294,7 @@ class Integer
|
|
|
1294
1294
|
# 4 * Complex(2, 0) # => (8+0i)
|
|
1295
1295
|
#
|
|
1296
1296
|
def *: (BigDecimal) -> BigDecimal
|
|
1297
|
-
|
|
1297
|
+
| ...
|
|
1298
1298
|
|
|
1299
1299
|
# <!--
|
|
1300
1300
|
# rdoc-file=numeric.c
|
|
@@ -1314,7 +1314,7 @@ class Integer
|
|
|
1314
1314
|
# 1 + 3.14 # => 4.140000000000001
|
|
1315
1315
|
#
|
|
1316
1316
|
def +: (BigDecimal) -> BigDecimal
|
|
1317
|
-
|
|
1317
|
+
| ...
|
|
1318
1318
|
|
|
1319
1319
|
# <!--
|
|
1320
1320
|
# rdoc-file=numeric.c
|
|
@@ -1330,7 +1330,7 @@ class Integer
|
|
|
1330
1330
|
# 4 - Complex(2, 0) # => (2+0i)
|
|
1331
1331
|
#
|
|
1332
1332
|
def -: (BigDecimal) -> BigDecimal
|
|
1333
|
-
|
|
1333
|
+
| ...
|
|
1334
1334
|
end
|
|
1335
1335
|
|
|
1336
1336
|
%a{annotate:rdoc:skip}
|
|
@@ -1369,7 +1369,7 @@ class Float
|
|
|
1369
1369
|
# f / Complex(2, 0) # => (1.57+0.0i)
|
|
1370
1370
|
#
|
|
1371
1371
|
def /: (BigDecimal) -> BigDecimal
|
|
1372
|
-
|
|
1372
|
+
| ...
|
|
1373
1373
|
|
|
1374
1374
|
# <!--
|
|
1375
1375
|
# rdoc-file=numeric.c
|
|
@@ -1384,7 +1384,7 @@ class Float
|
|
|
1384
1384
|
# f * Complex(2, 0) # => (6.28+0.0i)
|
|
1385
1385
|
#
|
|
1386
1386
|
def *: (BigDecimal) -> BigDecimal
|
|
1387
|
-
|
|
1387
|
+
| ...
|
|
1388
1388
|
|
|
1389
1389
|
# <!--
|
|
1390
1390
|
# rdoc-file=numeric.c
|
|
@@ -1404,7 +1404,7 @@ class Float
|
|
|
1404
1404
|
# 3.14 + Rational(1, 1) # => 4.140000000000001
|
|
1405
1405
|
#
|
|
1406
1406
|
def +: (BigDecimal) -> BigDecimal
|
|
1407
|
-
|
|
1407
|
+
| ...
|
|
1408
1408
|
|
|
1409
1409
|
# <!--
|
|
1410
1410
|
# rdoc-file=numeric.c
|
|
@@ -1419,7 +1419,7 @@ class Float
|
|
|
1419
1419
|
# f - Complex(1, 0) # => (2.14+0i)
|
|
1420
1420
|
#
|
|
1421
1421
|
def -: (BigDecimal) -> BigDecimal
|
|
1422
|
-
|
|
1422
|
+
| ...
|
|
1423
1423
|
end
|
|
1424
1424
|
|
|
1425
1425
|
%a{annotate:rdoc:skip}
|
|
@@ -1476,7 +1476,7 @@ class Rational
|
|
|
1476
1476
|
# Rational(20, 9) / 9.8 #=> 0.22675736961451246
|
|
1477
1477
|
#
|
|
1478
1478
|
def /: (BigDecimal) -> BigDecimal
|
|
1479
|
-
|
|
1479
|
+
| ...
|
|
1480
1480
|
|
|
1481
1481
|
# <!--
|
|
1482
1482
|
# rdoc-file=rational.c
|
|
@@ -1492,7 +1492,7 @@ class Rational
|
|
|
1492
1492
|
# Rational(-2, 9) * Rational(-9, 2) #=> (1/1)
|
|
1493
1493
|
#
|
|
1494
1494
|
def *: (BigDecimal) -> BigDecimal
|
|
1495
|
-
|
|
1495
|
+
| ...
|
|
1496
1496
|
|
|
1497
1497
|
# <!--
|
|
1498
1498
|
# rdoc-file=rational.c
|
|
@@ -1517,7 +1517,7 @@ class Rational
|
|
|
1517
1517
|
# Rational(2, 3) + Complex(1.0, 0.0) # => (1.6666666666666665+0.0i)
|
|
1518
1518
|
#
|
|
1519
1519
|
def +: (BigDecimal) -> BigDecimal
|
|
1520
|
-
|
|
1520
|
+
| ...
|
|
1521
1521
|
|
|
1522
1522
|
# <!--
|
|
1523
1523
|
# rdoc-file=rational.c
|
|
@@ -1532,7 +1532,7 @@ class Rational
|
|
|
1532
1532
|
# Rational(20, 9) - 9.8 #=> -7.577777777777778
|
|
1533
1533
|
#
|
|
1534
1534
|
def -: (BigDecimal) -> BigDecimal
|
|
1535
|
-
|
|
1535
|
+
| ...
|
|
1536
1536
|
end
|
|
1537
1537
|
|
|
1538
1538
|
%a{annotate:rdoc:skip}
|
|
@@ -1571,7 +1571,7 @@ class Complex
|
|
|
1571
1571
|
# Complex.rect(20, 9) / 9.8 # => (2.0408163265306123+0.9183673469387754i)
|
|
1572
1572
|
#
|
|
1573
1573
|
def /: (BigDecimal) -> Complex
|
|
1574
|
-
|
|
1574
|
+
| ...
|
|
1575
1575
|
|
|
1576
1576
|
# <!--
|
|
1577
1577
|
# rdoc-file=complex.c
|
|
@@ -1587,7 +1587,7 @@ class Complex
|
|
|
1587
1587
|
# Complex.rect(9, 8) * Rational(2, 3) # => ((6/1)+(16/3)*i)
|
|
1588
1588
|
#
|
|
1589
1589
|
def *: (BigDecimal) -> Complex
|
|
1590
|
-
|
|
1590
|
+
| ...
|
|
1591
1591
|
|
|
1592
1592
|
# <!--
|
|
1593
1593
|
# rdoc-file=complex.c
|
|
@@ -1612,7 +1612,7 @@ class Complex
|
|
|
1612
1612
|
# Complex(1, 2) + 3.14 # => (4.140000000000001+2i)
|
|
1613
1613
|
#
|
|
1614
1614
|
def +: (BigDecimal) -> Complex
|
|
1615
|
-
|
|
1615
|
+
| ...
|
|
1616
1616
|
|
|
1617
1617
|
# <!--
|
|
1618
1618
|
# rdoc-file=complex.c
|
|
@@ -1627,7 +1627,7 @@ class Complex
|
|
|
1627
1627
|
# Complex.rect(20, 9) - 9.8 # => (10.2+9i)
|
|
1628
1628
|
#
|
|
1629
1629
|
def -: (BigDecimal) -> Complex
|
|
1630
|
-
|
|
1630
|
+
| ...
|
|
1631
1631
|
end
|
|
1632
1632
|
|
|
1633
1633
|
%a{annotate:rdoc:skip}
|
|
@@ -25,7 +25,7 @@ class CGI
|
|
|
25
25
|
# - escape(string)
|
|
26
26
|
# -->
|
|
27
27
|
# URL-encode a string into application/x-www-form-urlencoded. Space characters
|
|
28
|
-
# (
|
|
28
|
+
# (<code>" "</code>) are encoded with plus signs (<code>"+"</code>)
|
|
29
29
|
# url_encoded_string = CGI.escape("'Stop!' said Fred")
|
|
30
30
|
# # => "%27Stop%21%27+said+Fred"
|
|
31
31
|
#
|
|
@@ -55,7 +55,7 @@ class CGI
|
|
|
55
55
|
# rdoc-file=lib/cgi/escape.rb
|
|
56
56
|
# - escapeHTML(string)
|
|
57
57
|
# -->
|
|
58
|
-
# Escape special characters in HTML, namely
|
|
58
|
+
# Escape special characters in HTML, namely <code>'&\"<></code>
|
|
59
59
|
# CGI.escapeHTML('Usage: foo "bar" <baz>')
|
|
60
60
|
# # => "Usage: foo "bar" <baz>"
|
|
61
61
|
#
|
|
@@ -65,8 +65,8 @@ class CGI
|
|
|
65
65
|
# rdoc-file=lib/cgi/escape.rb
|
|
66
66
|
# - escapeURIComponent(string)
|
|
67
67
|
# -->
|
|
68
|
-
# URL-encode a string following RFC 3986 Space characters (
|
|
69
|
-
# with (
|
|
68
|
+
# URL-encode a string following RFC 3986 Space characters (<code>" "</code>) are
|
|
69
|
+
# encoded with (<code>"%20"</code>)
|
|
70
70
|
# url_encoded_string = CGI.escapeURIComponent("'Stop!' said Fred")
|
|
71
71
|
# # => "%27Stop%21%27%20said%20Fred"
|
|
72
72
|
#
|
|
@@ -159,7 +159,7 @@ module Coverage
|
|
|
159
159
|
# - Coverage.peek_result => hash
|
|
160
160
|
# -->
|
|
161
161
|
# Returns a hash that contains filename as key and coverage array as value. This
|
|
162
|
-
# is the same as
|
|
162
|
+
# is the same as <code>Coverage.result(stop: false, clear: false)</code>.
|
|
163
163
|
#
|
|
164
164
|
# {
|
|
165
165
|
# "file.rb" => [1, 2, nil],
|
|
@@ -244,8 +244,9 @@ module Coverage
|
|
|
244
244
|
# -->
|
|
245
245
|
# Returns true if coverage measurement is supported for the given mode.
|
|
246
246
|
#
|
|
247
|
-
# The mode should be one of the following symbols:
|
|
248
|
-
#
|
|
247
|
+
# The mode should be one of the following symbols: <code>:lines</code>,
|
|
248
|
+
# <code>:oneshot_lines</code>, <code>:branches</code>, <code>:methods</code>,
|
|
249
|
+
# <code>:eval</code>.
|
|
249
250
|
#
|
|
250
251
|
# Example:
|
|
251
252
|
#
|
data/stdlib/date/0/date.rbs
CHANGED
|
@@ -165,8 +165,8 @@ class Date
|
|
|
165
165
|
#
|
|
166
166
|
# Date._parse('2001-02-03') # => {:year=>2001, :mon=>2, :mday=>3}
|
|
167
167
|
#
|
|
168
|
-
# If `comp` is `true` and the given year is in the range
|
|
169
|
-
# century is supplied; otherwise, the year is taken as given:
|
|
168
|
+
# If `comp` is `true` and the given year is in the range <code>(0..99)</code>,
|
|
169
|
+
# the current century is supplied; otherwise, the year is taken as given:
|
|
170
170
|
#
|
|
171
171
|
# Date._parse('01-02-03', true) # => {:year=>2001, :mon=>2, :mday=>3}
|
|
172
172
|
# Date._parse('01-02-03', false) # => {:year=>1, :mon=>2, :mday=>3}
|
|
@@ -508,8 +508,8 @@ class Date
|
|
|
508
508
|
# Date.parse('20010203') # => #<Date: 2001-02-03>
|
|
509
509
|
# Date.parse('3rd Feb 2001') # => #<Date: 2001-02-03>
|
|
510
510
|
#
|
|
511
|
-
# If `comp` is `true` and the given year is in the range
|
|
512
|
-
# century is supplied; otherwise, the year is taken as given:
|
|
511
|
+
# If `comp` is `true` and the given year is in the range <code>(0..99)</code>,
|
|
512
|
+
# the current century is supplied; otherwise, the year is taken as given:
|
|
513
513
|
#
|
|
514
514
|
# Date.parse('01-02-03', true) # => #<Date: 2001-02-03>
|
|
515
515
|
# Date.parse('01-02-03', false) # => #<Date: 0001-02-03>
|
|
@@ -800,7 +800,7 @@ class Date
|
|
|
800
800
|
# -->
|
|
801
801
|
# Compares `self` and `other`, returning:
|
|
802
802
|
#
|
|
803
|
-
# *
|
|
803
|
+
# * <code>-1</code> if `other` is larger.
|
|
804
804
|
# * `0` if the two are equal.
|
|
805
805
|
# * `1` if `other` is smaller.
|
|
806
806
|
# * `nil` if the two are incomparable.
|
|
@@ -822,7 +822,7 @@ class Date
|
|
|
822
822
|
# d <=> DateTime.new(2022, 7, 27) # => 0
|
|
823
823
|
# d <=> DateTime.new(2022, 7, 28) # => -1
|
|
824
824
|
#
|
|
825
|
-
# * A numeric (compares
|
|
825
|
+
# * A numeric (compares <code>self.ajd</code> to `other`):
|
|
826
826
|
#
|
|
827
827
|
# d <=> 2459788 # => -1
|
|
828
828
|
# d <=> 2459787 # => 1
|
|
@@ -859,7 +859,7 @@ class Date
|
|
|
859
859
|
# d === DateTime.new(2022, 7, 27) # => true
|
|
860
860
|
# d === DateTime.new(2022, 7, 28) # => false
|
|
861
861
|
#
|
|
862
|
-
# * A numeric (compares
|
|
862
|
+
# * A numeric (compares <code>self.jd</code> to `other`):
|
|
863
863
|
#
|
|
864
864
|
# d === 2459788 # => true
|
|
865
865
|
# d === 2459787 # => false
|
|
@@ -928,9 +928,10 @@ class Date
|
|
|
928
928
|
# rdoc-file=ext/date/date_core.c
|
|
929
929
|
# - asctime -> string
|
|
930
930
|
# -->
|
|
931
|
-
# Equivalent to #strftime with argument
|
|
931
|
+
# Equivalent to #strftime with argument <code>'%a %b %e %T %Y'</code> (or its
|
|
932
|
+
# [shorthand
|
|
932
933
|
# form](rdoc-ref:language/strftime_formatting.rdoc@Shorthand+Conversion+Specifie
|
|
933
|
-
# rs)
|
|
934
|
+
# rs) <code>'%c'</code>):
|
|
934
935
|
#
|
|
935
936
|
# Date.new(2001, 2, 3).asctime # => "Sat Feb 3 00:00:00 2001"
|
|
936
937
|
#
|
|
@@ -939,9 +940,10 @@ class Date
|
|
|
939
940
|
def asctime: () -> String
|
|
940
941
|
|
|
941
942
|
# <!-- rdoc-file=ext/date/date_core.c -->
|
|
942
|
-
# Equivalent to #strftime with argument
|
|
943
|
+
# Equivalent to #strftime with argument <code>'%a %b %e %T %Y'</code> (or its
|
|
944
|
+
# [shorthand
|
|
943
945
|
# form](rdoc-ref:language/strftime_formatting.rdoc@Shorthand+Conversion+Specifie
|
|
944
|
-
# rs)
|
|
946
|
+
# rs) <code>'%c'</code>):
|
|
945
947
|
#
|
|
946
948
|
# Date.new(2001, 2, 3).asctime # => "Sat Feb 3 00:00:00 2001"
|
|
947
949
|
#
|
|
@@ -993,7 +995,8 @@ class Date
|
|
|
993
995
|
# - deconstruct_keys(array_of_names_or_nil) -> hash
|
|
994
996
|
# -->
|
|
995
997
|
# Returns a hash of the name/value pairs, to use in pattern matching. Possible
|
|
996
|
-
# keys are:
|
|
998
|
+
# keys are: <code>:year</code>, <code>:month</code>, <code>:day</code>,
|
|
999
|
+
# <code>:wday</code>, <code>:yday</code>.
|
|
997
1000
|
#
|
|
998
1001
|
# Possible usages:
|
|
999
1002
|
#
|
|
@@ -1026,7 +1029,7 @@ class Date
|
|
|
1026
1029
|
# rdoc-file=ext/date/date_core.c
|
|
1027
1030
|
# - downto(min){|date| ... } -> self
|
|
1028
1031
|
# -->
|
|
1029
|
-
# Equivalent to #step with arguments `min` and
|
|
1032
|
+
# Equivalent to #step with arguments `min` and <code>-1</code>.
|
|
1030
1033
|
#
|
|
1031
1034
|
def downto: (Date min) { (Date) -> untyped } -> Date
|
|
1032
1035
|
| (Date min) -> Enumerator[Date, Date]
|
|
@@ -1071,8 +1074,8 @@ class Date
|
|
|
1071
1074
|
# rdoc-file=ext/date/date_core.c
|
|
1072
1075
|
# - httpdate -> string
|
|
1073
1076
|
# -->
|
|
1074
|
-
# Equivalent to #strftime with argument
|
|
1075
|
-
# for Dates and Times](rdoc-ref:language/strftime_formatting.rdoc):
|
|
1077
|
+
# Equivalent to #strftime with argument <code>'%a, %d %b %Y %T GMT'</code>; see
|
|
1078
|
+
# [Formats for Dates and Times](rdoc-ref:language/strftime_formatting.rdoc):
|
|
1076
1079
|
#
|
|
1077
1080
|
# Date.new(2001, 2, 3).httpdate # => "Sat, 03 Feb 2001 00:00:00 GMT"
|
|
1078
1081
|
#
|
|
@@ -1093,9 +1096,10 @@ class Date
|
|
|
1093
1096
|
# rdoc-file=ext/date/date_core.c
|
|
1094
1097
|
# - iso8601 -> string
|
|
1095
1098
|
# -->
|
|
1096
|
-
# Equivalent to #strftime with argument
|
|
1099
|
+
# Equivalent to #strftime with argument <code>'%Y-%m-%d'</code> (or its
|
|
1100
|
+
# [shorthand
|
|
1097
1101
|
# form](rdoc-ref:language/strftime_formatting.rdoc@Shorthand+Conversion+Specifie
|
|
1098
|
-
# rs)
|
|
1102
|
+
# rs) <code>'%F'</code>);
|
|
1099
1103
|
#
|
|
1100
1104
|
# Date.new(2001, 2, 3).iso8601 # => "2001-02-03"
|
|
1101
1105
|
#
|
|
@@ -1268,7 +1272,7 @@ class Date
|
|
|
1268
1272
|
# rdoc-file=ext/date/date_core.c
|
|
1269
1273
|
# - next_year(n = 1) -> new_date
|
|
1270
1274
|
# -->
|
|
1271
|
-
# Equivalent to #>> with argument
|
|
1275
|
+
# Equivalent to #>> with argument <code>n * 12</code>.
|
|
1272
1276
|
#
|
|
1273
1277
|
def next_year: (?Integer year) -> Date
|
|
1274
1278
|
|
|
@@ -1292,7 +1296,7 @@ class Date
|
|
|
1292
1296
|
# rdoc-file=ext/date/date_core.c
|
|
1293
1297
|
# - prev_year(n = 1) -> new_date
|
|
1294
1298
|
# -->
|
|
1295
|
-
# Equivalent to #<< with argument
|
|
1299
|
+
# Equivalent to #<< with argument <code>n * 12</code>.
|
|
1296
1300
|
#
|
|
1297
1301
|
def prev_year: (?Integer year) -> Date
|
|
1298
1302
|
|
|
@@ -1300,8 +1304,8 @@ class Date
|
|
|
1300
1304
|
# rdoc-file=ext/date/date_core.c
|
|
1301
1305
|
# - rfc2822 -> string
|
|
1302
1306
|
# -->
|
|
1303
|
-
# Equivalent to #strftime with argument
|
|
1304
|
-
# for Dates and Times](rdoc-ref:language/strftime_formatting.rdoc):
|
|
1307
|
+
# Equivalent to #strftime with argument <code>'%a, %-d %b %Y %T %z'</code>; see
|
|
1308
|
+
# [Formats for Dates and Times](rdoc-ref:language/strftime_formatting.rdoc):
|
|
1305
1309
|
#
|
|
1306
1310
|
# Date.new(2001, 2, 3).rfc2822 # => "Sat, 3 Feb 2001 00:00:00 +0000"
|
|
1307
1311
|
#
|
|
@@ -1311,8 +1315,8 @@ class Date
|
|
|
1311
1315
|
# rdoc-file=ext/date/date_core.c
|
|
1312
1316
|
# - rfc3339 -> string
|
|
1313
1317
|
# -->
|
|
1314
|
-
# Equivalent to #strftime with argument
|
|
1315
|
-
# Times](rdoc-ref:language/strftime_formatting.rdoc):
|
|
1318
|
+
# Equivalent to #strftime with argument <code>'%FT%T%:z'</code>; see [Formats
|
|
1319
|
+
# for Dates and Times](rdoc-ref:language/strftime_formatting.rdoc):
|
|
1316
1320
|
#
|
|
1317
1321
|
# Date.new(2001, 2, 3).rfc3339 # => "2001-02-03T00:00:00+00:00"
|
|
1318
1322
|
#
|
|
@@ -1373,8 +1377,8 @@ class Date
|
|
|
1373
1377
|
# Calls the block with specified dates; returns `self`.
|
|
1374
1378
|
#
|
|
1375
1379
|
# * The first `date` is `self`.
|
|
1376
|
-
# * Each successive `date` is
|
|
1377
|
-
# size in days.
|
|
1380
|
+
# * Each successive `date` is <code>date + step</code>, where `step` is the
|
|
1381
|
+
# numeric step size in days.
|
|
1378
1382
|
# * The last date is the last one that is before or equal to `limit`, which
|
|
1379
1383
|
# should be a Date object.
|
|
1380
1384
|
#
|
|
@@ -1462,7 +1466,7 @@ class Date
|
|
|
1462
1466
|
# Returns a string representation of the date in `self` in [ISO 8601 extended
|
|
1463
1467
|
# date
|
|
1464
1468
|
# format](rdoc-ref:language/strftime_formatting.rdoc@ISO+8601+Format+Specificati
|
|
1465
|
-
# ons) (
|
|
1469
|
+
# ons) (<code>'%Y-%m-%d'</code>):
|
|
1466
1470
|
#
|
|
1467
1471
|
# Date.new(2001, 2, 3).to_s # => "2001-02-03"
|
|
1468
1472
|
#
|
|
@@ -1516,9 +1520,10 @@ class Date
|
|
|
1516
1520
|
def wednesday?: () -> bool
|
|
1517
1521
|
|
|
1518
1522
|
# <!-- rdoc-file=ext/date/date_core.c -->
|
|
1519
|
-
# Equivalent to #strftime with argument
|
|
1523
|
+
# Equivalent to #strftime with argument <code>'%Y-%m-%d'</code> (or its
|
|
1524
|
+
# [shorthand
|
|
1520
1525
|
# form](rdoc-ref:language/strftime_formatting.rdoc@Shorthand+Conversion+Specifie
|
|
1521
|
-
# rs)
|
|
1526
|
+
# rs) <code>'%F'</code>);
|
|
1522
1527
|
#
|
|
1523
1528
|
# Date.new(2001, 2, 3).iso8601 # => "2001-02-03"
|
|
1524
1529
|
#
|
data/stdlib/date/0/date_time.rbs
CHANGED
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
# #=> #<DateTime: 2001-02-03T12:00:00+00:00 ...>
|
|
25
25
|
#
|
|
26
26
|
# An optional argument, the offset, indicates the difference between the local
|
|
27
|
-
# time and UTC. For example,
|
|
28
|
-
# UTC,
|
|
29
|
-
# be -1 to +1, and its precision is assumed at most
|
|
30
|
-
# zero (equals to UTC).
|
|
27
|
+
# time and UTC. For example, <code>Rational(3,24)</code> represents ahead of 3
|
|
28
|
+
# hours of UTC, <code>Rational(-5,24)</code> represents behind of 5 hours of
|
|
29
|
+
# UTC. The offset should be -1 to +1, and its precision is assumed at most
|
|
30
|
+
# second. The default value is zero (equals to UTC).
|
|
31
31
|
#
|
|
32
32
|
# DateTime.new(2001,2,3,4,5,6,Rational(3,24))
|
|
33
33
|
# #=> #<DateTime: 2001-02-03T04:05:06+03:00 ...>
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
#
|
|
40
40
|
# An optional argument, the day of calendar reform (`start`), denotes a Julian
|
|
41
41
|
# day number, which should be 2298874 to 2426355 or negative/positive infinity.
|
|
42
|
-
# The default value is
|
|
42
|
+
# The default value is <code>Date::ITALY</code> (2299161=1582-10-15).
|
|
43
43
|
#
|
|
44
44
|
# A DateTime object has various methods. See each reference.
|
|
45
45
|
#
|
|
@@ -183,8 +183,8 @@ class DateTime < Date
|
|
|
183
183
|
# #=> #<DateTime: 2001-02-03T04:05:06+00:00 ...>
|
|
184
184
|
#
|
|
185
185
|
# Raise an ArgumentError when the string length is longer than *limit*. You can
|
|
186
|
-
# stop this check by passing
|
|
187
|
-
# to parse.
|
|
186
|
+
# stop this check by passing <code>limit: nil</code>, but note that it may take
|
|
187
|
+
# a long time to parse.
|
|
188
188
|
#
|
|
189
189
|
def self.httpdate: (String str, ?Integer start) -> DateTime
|
|
190
190
|
|
|
@@ -203,8 +203,8 @@ class DateTime < Date
|
|
|
203
203
|
# #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
|
204
204
|
#
|
|
205
205
|
# Raise an ArgumentError when the string length is longer than *limit*. You can
|
|
206
|
-
# stop this check by passing
|
|
207
|
-
# to parse.
|
|
206
|
+
# stop this check by passing <code>limit: nil</code>, but note that it may take
|
|
207
|
+
# a long time to parse.
|
|
208
208
|
#
|
|
209
209
|
def self.iso8601: (String str, ?Integer start) -> DateTime
|
|
210
210
|
|
|
@@ -237,8 +237,8 @@ class DateTime < Date
|
|
|
237
237
|
# #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
|
238
238
|
#
|
|
239
239
|
# Raise an ArgumentError when the string length is longer than *limit*. You can
|
|
240
|
-
# stop this check by passing
|
|
241
|
-
# to parse.
|
|
240
|
+
# stop this check by passing <code>limit: nil</code>, but note that it may take
|
|
241
|
+
# a long time to parse.
|
|
242
242
|
#
|
|
243
243
|
def self.jisx0301: (String str, ?Integer start) -> DateTime
|
|
244
244
|
|
|
@@ -288,8 +288,8 @@ class DateTime < Date
|
|
|
288
288
|
# #=> #<DateTime: 2001-02-03T16:05:06+00:00 ...>
|
|
289
289
|
#
|
|
290
290
|
# Raise an ArgumentError when the string length is longer than *limit*. You can
|
|
291
|
-
# stop this check by passing
|
|
292
|
-
# to parse.
|
|
291
|
+
# stop this check by passing <code>limit: nil</code>, but note that it may take
|
|
292
|
+
# a long time to parse.
|
|
293
293
|
#
|
|
294
294
|
def self.parse: (String str, ?boolish complete, ?Integer start) -> DateTime
|
|
295
295
|
|
|
@@ -305,8 +305,8 @@ class DateTime < Date
|
|
|
305
305
|
# #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
|
306
306
|
#
|
|
307
307
|
# Raise an ArgumentError when the string length is longer than *limit*. You can
|
|
308
|
-
# stop this check by passing
|
|
309
|
-
# to parse.
|
|
308
|
+
# stop this check by passing <code>limit: nil</code>, but note that it may take
|
|
309
|
+
# a long time to parse.
|
|
310
310
|
#
|
|
311
311
|
def self.rfc2822: (String str, ?Integer start) -> DateTime
|
|
312
312
|
|
|
@@ -321,8 +321,8 @@ class DateTime < Date
|
|
|
321
321
|
# #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
|
322
322
|
#
|
|
323
323
|
# Raise an ArgumentError when the string length is longer than *limit*. You can
|
|
324
|
-
# stop this check by passing
|
|
325
|
-
# to parse.
|
|
324
|
+
# stop this check by passing <code>limit: nil</code>, but note that it may take
|
|
325
|
+
# a long time to parse.
|
|
326
326
|
#
|
|
327
327
|
def self.rfc3339: (String str, ?Integer start) -> DateTime
|
|
328
328
|
|
|
@@ -338,8 +338,8 @@ class DateTime < Date
|
|
|
338
338
|
# #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
|
339
339
|
#
|
|
340
340
|
# Raise an ArgumentError when the string length is longer than *limit*. You can
|
|
341
|
-
# stop this check by passing
|
|
342
|
-
# to parse.
|
|
341
|
+
# stop this check by passing <code>limit: nil</code>, but note that it may take
|
|
342
|
+
# a long time to parse.
|
|
343
343
|
#
|
|
344
344
|
def self.rfc822: (String str, ?Integer start) -> DateTime
|
|
345
345
|
|
|
@@ -383,8 +383,8 @@ class DateTime < Date
|
|
|
383
383
|
# #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
|
384
384
|
#
|
|
385
385
|
# Raise an ArgumentError when the string length is longer than *limit*. You can
|
|
386
|
-
# stop this check by passing
|
|
387
|
-
# to parse.
|
|
386
|
+
# stop this check by passing <code>limit: nil</code>, but note that it may take
|
|
387
|
+
# a long time to parse.
|
|
388
388
|
#
|
|
389
389
|
def self.xmlschema: (String str, ?Integer start) -> DateTime
|
|
390
390
|
|
|
@@ -393,8 +393,9 @@ class DateTime < Date
|
|
|
393
393
|
# - deconstruct_keys(array_of_names_or_nil) -> hash
|
|
394
394
|
# -->
|
|
395
395
|
# Returns a hash of the name/value pairs, to use in pattern matching. Possible
|
|
396
|
-
# keys are:
|
|
397
|
-
#
|
|
396
|
+
# keys are: <code>:year</code>, <code>:month</code>, <code>:day</code>,
|
|
397
|
+
# <code>:wday</code>, <code>:yday</code>, <code>:hour</code>, <code>:min</code>,
|
|
398
|
+
# <code>:sec</code>, <code>:sec_fraction</code>, <code>:zone</code>.
|
|
398
399
|
#
|
|
399
400
|
# Possible usages:
|
|
400
401
|
#
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
#
|
|
39
39
|
# Occasionally, you may want to disable the `did_you_mean` gem for e.g.
|
|
40
40
|
# debugging issues in the error object itself. You can disable it entirely by
|
|
41
|
-
# specifying
|
|
41
|
+
# specifying <code>--disable-did_you_mean</code> option to the `ruby` command:
|
|
42
42
|
#
|
|
43
43
|
# $ ruby --disable-did_you_mean -e "1.zeor?"
|
|
44
44
|
# -e:1:in `<main>': undefined method `zeor?' for 1:Integer (NameError)
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
#
|
|
56
56
|
# Sometimes, you do not want to disable the gem entirely, but need to get the
|
|
57
57
|
# original error message without suggestions (e.g. testing). In this case, you
|
|
58
|
-
# could use the
|
|
58
|
+
# could use the <code>#original_message</code> method on the error object:
|
|
59
59
|
#
|
|
60
60
|
# no_method_error = begin
|
|
61
61
|
# 1.zeor?
|
|
@@ -92,9 +92,9 @@ module DidYouMean
|
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
# <!-- rdoc-file=lib/did_you_mean/formatter.rb -->
|
|
95
|
-
# The
|
|
96
|
-
# formatter responds to the `message_for` method and it returns a human
|
|
97
|
-
# string.
|
|
95
|
+
# The <code>DidYouMean::Formatter</code> is the basic, default formatter for the
|
|
96
|
+
# gem. The formatter responds to the `message_for` method and it returns a human
|
|
97
|
+
# readable string.
|
|
98
98
|
#
|
|
99
99
|
class Formatter
|
|
100
100
|
# <!--
|
|
@@ -170,15 +170,16 @@ module DidYouMean
|
|
|
170
170
|
NAMES_TO_EXCLUDE: Hash[untyped, Array[Symbol]]
|
|
171
171
|
|
|
172
172
|
# <!-- rdoc-file=lib/did_you_mean/spell_checkers/method_name_checker.rb -->
|
|
173
|
-
#
|
|
174
|
-
# that take an argument. Unlike
|
|
175
|
-
# reserved words
|
|
176
|
-
#
|
|
173
|
+
# <code>MethodNameChecker::RB_RESERVED_WORDS</code> is the list of reserved
|
|
174
|
+
# words in Ruby that take an argument. Unlike
|
|
175
|
+
# <code>VariableNameChecker::RB_RESERVED_WORDS</code>, these reserved words
|
|
176
|
+
# require an argument, and a `NoMethodError` is raised due to the presence of
|
|
177
|
+
# the argument.
|
|
177
178
|
#
|
|
178
179
|
# The `MethodNameChecker` will use this list to suggest a reversed word if a
|
|
179
180
|
# `NoMethodError` is raised and found closest matches.
|
|
180
181
|
#
|
|
181
|
-
# Also see
|
|
182
|
+
# Also see <code>VariableNameChecker::RB_RESERVED_WORDS</code>.
|
|
182
183
|
#
|
|
183
184
|
RB_RESERVED_WORDS: Array[Symbol]
|
|
184
185
|
|
|
@@ -295,19 +296,19 @@ module DidYouMean
|
|
|
295
296
|
NAMES_TO_EXCLUDE: Hash[String, Array[Symbol]]
|
|
296
297
|
|
|
297
298
|
# <!-- rdoc-file=lib/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb -->
|
|
298
|
-
#
|
|
299
|
-
# Ruby. They could be declared like methods are, and a typo
|
|
300
|
-
# raise a `NameError` because of the way they are declared.
|
|
299
|
+
# <code>VariableNameChecker::RB_RESERVED_WORDS</code> is the list of all
|
|
300
|
+
# reserved words in Ruby. They could be declared like methods are, and a typo
|
|
301
|
+
# would cause Ruby to raise a `NameError` because of the way they are declared.
|
|
301
302
|
#
|
|
302
|
-
# The
|
|
303
|
-
# `NameError` is raised and found closest matches, excluding:
|
|
303
|
+
# The <code>:VariableNameChecker</code> will use this list to suggest a reversed
|
|
304
|
+
# word if a `NameError` is raised and found closest matches, excluding:
|
|
304
305
|
#
|
|
305
306
|
# * +do+
|
|
306
307
|
# * +if+
|
|
307
308
|
# * +in+
|
|
308
309
|
# * +or+
|
|
309
310
|
#
|
|
310
|
-
# Also see
|
|
311
|
+
# Also see <code>MethodNameChecker::RB_RESERVED_WORDS</code>.
|
|
311
312
|
#
|
|
312
313
|
RB_RESERVED_WORDS: Array[Symbol]
|
|
313
314
|
|