rbs 3.6.1 → 3.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/comments.yml +2 -2
- data/.github/workflows/dependabot.yml +1 -1
- data/.github/workflows/ruby.yml +34 -10
- data/.github/workflows/windows.yml +20 -3
- data/.gitignore +1 -0
- data/.rubocop.yml +26 -1
- data/CHANGELOG.md +241 -0
- data/Rakefile +54 -4
- data/config.yml +317 -0
- data/core/array.rbs +1756 -1591
- data/core/basic_object.rbs +38 -35
- data/core/comparable.rbs +1 -1
- data/core/complex.rbs +166 -94
- data/core/data.rbs +2 -2
- data/core/dir.rbs +2 -18
- data/core/encoding.rbs +12 -32
- data/core/enumerable.rbs +270 -266
- data/core/enumerator.rbs +14 -4
- data/core/env.rbs +1 -1
- data/core/errno.rbs +33 -16
- data/core/errors.rbs +6 -2
- data/core/exception.rbs +342 -167
- data/core/fiber.rbs +3 -2
- data/core/file.rbs +26 -75
- data/core/float.rbs +125 -72
- data/core/gc.rbs +158 -42
- data/core/hash.rbs +122 -143
- data/core/integer.rbs +79 -50
- data/core/io/buffer.rbs +49 -43
- data/core/io.rbs +108 -151
- data/core/kernel.rbs +341 -209
- data/core/match_data.rbs +76 -2
- data/core/math.rbs +0 -36
- data/core/method.rbs +2 -2
- data/core/module.rbs +32 -27
- data/core/nil_class.rbs +2 -2
- data/core/numeric.rbs +101 -104
- data/core/object.rbs +1 -5
- data/core/object_space/weak_key_map.rbs +3 -4
- data/core/object_space.rbs +3 -3
- data/core/proc.rbs +82 -14
- data/core/process.rbs +110 -58
- data/core/ractor.rbs +57 -4
- data/core/range.rbs +114 -87
- data/core/rational.rbs +0 -2
- data/core/rbs/unnamed/argf.rbs +237 -36
- data/core/rbs/unnamed/env_class.rbs +35 -53
- data/core/rbs/unnamed/random.rbs +1 -2
- data/core/regexp.rbs +10 -56
- data/core/ruby_vm.rbs +88 -9
- data/core/rubygems/config_file.rbs +3 -0
- data/core/rubygems/errors.rbs +3 -6
- data/core/rubygems/platform.rbs +0 -9
- data/core/rubygems/rubygems.rbs +3 -6
- data/core/rubygems/version.rbs +8 -8
- data/core/set.rbs +4 -16
- data/core/string.rbs +271 -264
- data/core/struct.rbs +6 -18
- data/core/symbol.rbs +14 -21
- data/core/thread.rbs +32 -35
- data/core/time.rbs +131 -50
- data/core/trace_point.rbs +124 -113
- data/core/true_class.rbs +0 -1
- data/core/unbound_method.rbs +1 -1
- data/core/warning.rbs +9 -2
- data/docs/architecture.md +1 -1
- data/docs/syntax.md +17 -10
- data/ext/rbs_extension/extconf.rb +11 -0
- data/ext/rbs_extension/location.c +61 -29
- data/ext/rbs_extension/location.h +4 -3
- data/ext/rbs_extension/main.c +23 -1
- data/ext/rbs_extension/parser.c +506 -517
- data/ext/rbs_extension/parserstate.c +109 -30
- data/ext/rbs_extension/parserstate.h +6 -4
- data/ext/rbs_extension/rbs_extension.h +1 -10
- data/{ext/rbs_extension → include/rbs}/constants.h +21 -19
- data/include/rbs/ruby_objs.h +72 -0
- data/include/rbs/util/rbs_constant_pool.h +219 -0
- data/include/rbs.h +7 -0
- data/lib/rbs/annotate/annotations.rb +3 -3
- data/lib/rbs/annotate/rdoc_source.rb +2 -2
- data/lib/rbs/ast/declarations.rb +9 -4
- data/lib/rbs/ast/directives.rb +10 -0
- data/lib/rbs/ast/members.rb +2 -0
- data/lib/rbs/ast/type_param.rb +2 -12
- data/lib/rbs/cli/diff.rb +3 -3
- data/lib/rbs/cli/validate.rb +2 -1
- data/lib/rbs/cli.rb +16 -16
- data/lib/rbs/collection/config/lockfile_generator.rb +58 -8
- data/lib/rbs/collection/config.rb +5 -3
- data/lib/rbs/collection/sources/rubygems.rb +1 -1
- data/lib/rbs/collection.rb +1 -0
- data/lib/rbs/definition.rb +51 -34
- data/lib/rbs/definition_builder/ancestor_builder.rb +5 -3
- data/lib/rbs/definition_builder.rb +83 -24
- data/lib/rbs/environment.rb +33 -18
- data/lib/rbs/environment_loader.rb +6 -1
- data/lib/rbs/errors.rb +24 -0
- data/lib/rbs/locator.rb +2 -0
- data/lib/rbs/method_type.rb +2 -0
- data/lib/rbs/namespace.rb +1 -0
- data/lib/rbs/parser_aux.rb +40 -3
- data/lib/rbs/prototype/rb.rb +20 -12
- data/lib/rbs/prototype/rbi.rb +11 -6
- data/lib/rbs/prototype/runtime/value_object_generator.rb +7 -5
- data/lib/rbs/prototype/runtime.rb +7 -5
- data/lib/rbs/subtractor.rb +3 -3
- data/lib/rbs/test/hook.rb +47 -42
- data/lib/rbs/test/type_check.rb +7 -5
- data/lib/rbs/type_name.rb +14 -9
- data/lib/rbs/types.rb +63 -14
- data/lib/rbs/unit_test/spy.rb +4 -2
- data/lib/rbs/unit_test/type_assertions.rb +19 -13
- data/lib/rbs/unit_test/with_aliases.rb +3 -1
- data/lib/rbs/validator.rb +7 -1
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +10 -5
- data/lib/rbs.rb +1 -0
- data/lib/rdoc_plugin/parser.rb +2 -2
- data/rbs.gemspec +6 -2
- data/sig/ancestor_graph.rbs +5 -5
- data/sig/annotate/rdoc_source.rbs +2 -0
- data/sig/cli.rbs +2 -0
- data/sig/collection/config/lockfile_generator.rbs +9 -1
- data/sig/declarations.rbs +10 -3
- data/sig/definition.rbs +80 -12
- data/sig/definition_builder.rbs +18 -4
- data/sig/directives.rbs +17 -1
- data/sig/environment.rbs +3 -1
- data/sig/errors.rbs +19 -0
- data/sig/namespace.rbs +2 -3
- data/sig/parser.rbs +5 -1
- data/sig/prototype/rb.rbs +1 -1
- data/sig/resolver/constant_resolver.rbs +2 -2
- data/sig/resolver/context.rbs +1 -1
- data/sig/subtractor.rbs +1 -1
- data/sig/test/type_check.rbs +2 -2
- data/sig/type_alias_dependency.rbs +2 -2
- data/sig/type_alias_regularity.rbs +6 -6
- data/sig/type_param.rbs +4 -4
- data/sig/typename.rbs +8 -5
- data/sig/types.rbs +1 -1
- data/sig/unit_test/spy.rbs +2 -0
- data/sig/unit_test/type_assertions.rbs +2 -0
- data/sig/use_map.rbs +1 -1
- data/sig/validator.rbs +6 -2
- data/sig/vendorer.rbs +1 -1
- data/sig/writer.rbs +1 -1
- data/{ext/rbs_extension → src}/constants.c +35 -36
- data/src/ruby_objs.c +799 -0
- data/src/util/rbs_constant_pool.c +342 -0
- data/stdlib/base64/0/base64.rbs +0 -9
- data/stdlib/benchmark/0/benchmark.rbs +11 -2
- data/stdlib/bigdecimal/0/big_decimal.rbs +26 -182
- data/stdlib/cgi/0/core.rbs +60 -3
- data/stdlib/cgi/0/manifest.yaml +1 -0
- data/stdlib/coverage/0/coverage.rbs +0 -3
- data/stdlib/csv/0/csv.rbs +18 -58
- data/stdlib/csv/0/manifest.yaml +1 -0
- data/stdlib/date/0/date.rbs +27 -42
- data/stdlib/did_you_mean/0/did_you_mean.rbs +1 -6
- data/stdlib/digest/0/digest.rbs +25 -2
- data/stdlib/erb/0/erb.rbs +0 -1
- data/stdlib/etc/0/etc.rbs +51 -34
- data/stdlib/fileutils/0/fileutils.rbs +3 -44
- data/stdlib/io-console/0/io-console.rbs +69 -15
- data/stdlib/ipaddr/0/ipaddr.rbs +16 -4
- data/stdlib/json/0/json.rbs +107 -120
- data/stdlib/logger/0/log_device.rbs +1 -1
- data/stdlib/logger/0/logger.rbs +3 -18
- data/stdlib/minitest/0/kernel.rbs +2 -2
- data/stdlib/minitest/0/minitest/abstract_reporter.rbs +4 -1
- data/stdlib/minitest/0/minitest/assertion.rbs +1 -0
- data/stdlib/minitest/0/minitest/assertions.rbs +58 -13
- data/stdlib/minitest/0/minitest/backtrace_filter.rbs +7 -0
- data/stdlib/minitest/0/minitest/bench_spec.rbs +8 -8
- data/stdlib/minitest/0/minitest/benchmark.rbs +17 -16
- data/stdlib/minitest/0/minitest/compress.rbs +13 -0
- data/stdlib/minitest/0/minitest/error_on_warning.rbs +3 -0
- data/stdlib/minitest/0/minitest/mock.rbs +9 -5
- data/stdlib/minitest/0/minitest/parallel/executor.rbs +4 -0
- data/stdlib/minitest/0/minitest/parallel/test/class_methods.rbs +0 -1
- data/stdlib/minitest/0/minitest/pride_io.rbs +8 -0
- data/stdlib/minitest/0/minitest/pride_lol.rbs +2 -0
- data/stdlib/minitest/0/minitest/progress_reporter.rbs +1 -1
- data/stdlib/minitest/0/minitest/reportable.rbs +2 -0
- data/stdlib/minitest/0/minitest/runnable.rbs +33 -1
- data/stdlib/minitest/0/minitest/spec/dsl/instance_methods.rbs +1 -1
- data/stdlib/minitest/0/minitest/spec/dsl.rbs +10 -6
- data/stdlib/minitest/0/minitest/spec.rbs +1 -1
- data/stdlib/minitest/0/minitest/statistics_reporter.rbs +5 -0
- data/stdlib/minitest/0/minitest/summary_reporter.rbs +0 -7
- data/stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs +1 -1
- data/stdlib/minitest/0/minitest/test.rbs +7 -14
- data/stdlib/minitest/0/minitest/unexpected_error.rbs +2 -0
- data/stdlib/minitest/0/minitest/unexpected_warning.rbs +6 -0
- data/stdlib/minitest/0/minitest/unit.rbs +1 -2
- data/stdlib/minitest/0/minitest.rbs +41 -892
- data/stdlib/monitor/0/monitor.rbs +13 -4
- data/stdlib/net-http/0/net-http.rbs +42 -109
- data/stdlib/nkf/0/nkf.rbs +30 -0
- data/stdlib/objspace/0/objspace.rbs +1 -2
- data/stdlib/observable/0/observable.rbs +1 -1
- data/stdlib/open-uri/0/manifest.yaml +1 -0
- data/stdlib/open-uri/0/open-uri.rbs +52 -0
- data/stdlib/open3/0/open3.rbs +0 -8
- data/stdlib/openssl/0/manifest.yaml +1 -0
- data/stdlib/openssl/0/openssl.rbs +235 -143
- data/stdlib/optparse/0/optparse.rbs +58 -18
- data/stdlib/pathname/0/pathname.rbs +2 -8
- data/stdlib/pp/0/pp.rbs +3 -1
- data/stdlib/prettyprint/0/prettyprint.rbs +0 -4
- data/stdlib/pstore/0/pstore.rbs +0 -6
- data/stdlib/psych/0/core_ext.rbs +12 -0
- data/stdlib/psych/0/psych.rbs +15 -4
- data/stdlib/pty/0/pty.rbs +46 -4
- data/stdlib/rdoc/0/code_object.rbs +0 -4
- data/stdlib/rdoc/0/markup.rbs +10 -12
- data/stdlib/rdoc/0/rdoc.rbs +13 -8
- data/stdlib/resolv/0/resolv.rbs +21 -12
- data/stdlib/ripper/0/ripper.rbs +0 -2
- data/stdlib/securerandom/0/securerandom.rbs +7 -2
- data/stdlib/shellwords/0/shellwords.rbs +11 -12
- data/stdlib/singleton/0/singleton.rbs +0 -1
- data/stdlib/socket/0/addrinfo.rbs +1 -2
- data/stdlib/socket/0/basic_socket.rbs +0 -5
- data/stdlib/socket/0/socket.rbs +32 -27
- data/stdlib/socket/0/tcp_server.rbs +0 -3
- data/stdlib/socket/0/tcp_socket.rbs +36 -3
- data/stdlib/socket/0/udp_socket.rbs +0 -1
- data/stdlib/socket/0/unix_server.rbs +0 -3
- data/stdlib/socket/0/unix_socket.rbs +4 -2
- data/{core/string_io.rbs → stdlib/stringio/0/stringio.rbs} +1 -1
- data/stdlib/strscan/0/string_scanner.rbs +1265 -422
- data/stdlib/tempfile/0/tempfile.rbs +135 -28
- data/stdlib/time/0/time.rbs +48 -35
- data/stdlib/timeout/0/timeout.rbs +11 -8
- data/stdlib/tmpdir/0/tmpdir.rbs +10 -3
- data/stdlib/tsort/0/tsort.rbs +0 -4
- data/stdlib/uri/0/common.rbs +28 -30
- data/stdlib/uri/0/ftp.rbs +1 -1
- data/stdlib/uri/0/generic.rbs +22 -18
- data/stdlib/uri/0/http.rbs +2 -2
- data/stdlib/uri/0/rfc2396_parser.rbs +3 -0
- data/stdlib/zlib/0/buf_error.rbs +1 -70
- data/stdlib/zlib/0/data_error.rbs +1 -70
- data/stdlib/zlib/0/deflate.rbs +8 -72
- data/stdlib/zlib/0/error.rbs +1 -70
- data/stdlib/zlib/0/gzip_file/crc_error.rbs +2 -105
- data/stdlib/zlib/0/gzip_file/error.rbs +2 -105
- data/stdlib/zlib/0/gzip_file/length_error.rbs +2 -105
- data/stdlib/zlib/0/gzip_file/no_footer.rbs +2 -105
- data/stdlib/zlib/0/gzip_file.rbs +1 -71
- data/stdlib/zlib/0/gzip_reader.rbs +3 -74
- data/stdlib/zlib/0/gzip_writer.rbs +1 -70
- data/stdlib/zlib/0/inflate.rbs +4 -71
- data/stdlib/zlib/0/mem_error.rbs +1 -70
- data/stdlib/zlib/0/need_dict.rbs +1 -70
- data/stdlib/zlib/0/stream_end.rbs +1 -70
- data/stdlib/zlib/0/stream_error.rbs +1 -70
- data/stdlib/zlib/0/version_error.rbs +1 -70
- data/stdlib/zlib/0/zlib.rbs +0 -2
- data/stdlib/zlib/0/zstream.rbs +4 -72
- metadata +17 -13
- data/ext/rbs_extension/ruby_objs.c +0 -602
- data/ext/rbs_extension/ruby_objs.h +0 -51
- data/stdlib/minitest/0/manifest.yaml +0 -2
data/core/file.rbs
CHANGED
@@ -49,7 +49,6 @@
|
|
49
49
|
# * May also contain a 1-character [file-create
|
50
50
|
# mode](rdoc-ref:File@File-Create+Mode).
|
51
51
|
#
|
52
|
-
#
|
53
52
|
# #### Read/Write Mode
|
54
53
|
#
|
55
54
|
# The read/write `mode` determines:
|
@@ -61,14 +60,11 @@
|
|
61
60
|
# * The initial read position in the file.
|
62
61
|
# * Where in the file reading can occur.
|
63
62
|
#
|
64
|
-
#
|
65
63
|
# * Whether writing is allowed, and if so:
|
66
64
|
#
|
67
65
|
# * The initial write position in the file.
|
68
66
|
# * Where in the file writing can occur.
|
69
67
|
#
|
70
|
-
#
|
71
|
-
#
|
72
68
|
# These tables summarize:
|
73
69
|
#
|
74
70
|
# Read/Write Modes for Existing File
|
@@ -110,7 +106,6 @@
|
|
110
106
|
# * `Error` means that an exception is raised if disallowed reading or writing
|
111
107
|
# is attempted.
|
112
108
|
#
|
113
|
-
#
|
114
109
|
# ##### Read/Write Modes for Existing File
|
115
110
|
#
|
116
111
|
# * `'r'`:
|
@@ -142,7 +137,6 @@
|
|
142
137
|
#
|
143
138
|
# f.write('foo') # Raises IOError.
|
144
139
|
#
|
145
|
-
#
|
146
140
|
# * `'w'`:
|
147
141
|
#
|
148
142
|
# * File is initially truncated:
|
@@ -197,7 +191,6 @@
|
|
197
191
|
#
|
198
192
|
# f.read # Raises IOError.
|
199
193
|
#
|
200
|
-
#
|
201
194
|
# * `'a'`:
|
202
195
|
#
|
203
196
|
# * File is not initially truncated:
|
@@ -230,7 +223,6 @@
|
|
230
223
|
#
|
231
224
|
# f.read # Raises IOError.
|
232
225
|
#
|
233
|
-
#
|
234
226
|
# * `'r+'`:
|
235
227
|
#
|
236
228
|
# * File is not initially truncated:
|
@@ -286,7 +278,6 @@
|
|
286
278
|
# File.read(path)
|
287
279
|
# # => "WWWst lineXXXecond line\nFourth line\nFifth YYYe\n\u0000\u0000ZZZ"
|
288
280
|
#
|
289
|
-
#
|
290
281
|
# * `'a+'`:
|
291
282
|
#
|
292
283
|
# * File is not initially truncated:
|
@@ -326,8 +317,6 @@
|
|
326
317
|
# f.seek(-3, :END)
|
327
318
|
# f.read # => "bat"
|
328
319
|
#
|
329
|
-
#
|
330
|
-
#
|
331
320
|
# ##### Read/Write Modes for File To Be Created
|
332
321
|
#
|
333
322
|
# Note that modes `'r'` and `'r+'` are not allowed for a non-existent file
|
@@ -383,7 +372,6 @@
|
|
383
372
|
#
|
384
373
|
# f.read # Raises IOError.
|
385
374
|
#
|
386
|
-
#
|
387
375
|
# * `'a'`:
|
388
376
|
#
|
389
377
|
# * File's initial write position is 0:
|
@@ -411,7 +399,6 @@
|
|
411
399
|
#
|
412
400
|
# f.read # Raises IOError.
|
413
401
|
#
|
414
|
-
#
|
415
402
|
# * `'w+'`:
|
416
403
|
#
|
417
404
|
# * File's initial position is 0:
|
@@ -476,7 +463,6 @@
|
|
476
463
|
# f.read
|
477
464
|
# # => "bah"
|
478
465
|
#
|
479
|
-
#
|
480
466
|
# * `'a+'`:
|
481
467
|
#
|
482
468
|
# * File's initial write position is 0:
|
@@ -515,8 +501,6 @@
|
|
515
501
|
# f.pos = 800
|
516
502
|
# f.read # => ""
|
517
503
|
#
|
518
|
-
#
|
519
|
-
#
|
520
504
|
# #### Data Mode
|
521
505
|
#
|
522
506
|
# To specify whether data is to be treated as text or as binary data, either of
|
@@ -529,7 +513,6 @@
|
|
529
513
|
# `Encoding::ASCII_8BIT`; on Windows, suppresses conversion between EOL and
|
530
514
|
# CRLF and disables interpreting `0x1A` as an end-of-file marker.
|
531
515
|
#
|
532
|
-
#
|
533
516
|
# If neither is given, the stream defaults to text data.
|
534
517
|
#
|
535
518
|
# Examples:
|
@@ -550,7 +533,6 @@
|
|
550
533
|
# * `'x'`: Creates the file if it does not exist; raises an exception if the
|
551
534
|
# file exists.
|
552
535
|
#
|
553
|
-
#
|
554
536
|
# Example:
|
555
537
|
#
|
556
538
|
# File.new('t.tmp', 'wx')
|
@@ -571,7 +553,6 @@
|
|
571
553
|
# * `File::RDWR`: Open for reading and writing.
|
572
554
|
# * `File::APPEND`: Open for appending only.
|
573
555
|
#
|
574
|
-
#
|
575
556
|
# Examples:
|
576
557
|
#
|
577
558
|
# File.new('t.txt', File::RDONLY)
|
@@ -588,7 +569,6 @@
|
|
588
569
|
# * `File::EXCL`: Raise an exception if `File::CREAT` is given and the file
|
589
570
|
# exists.
|
590
571
|
#
|
591
|
-
#
|
592
572
|
# ### Data Mode Specified as an Integer
|
593
573
|
#
|
594
574
|
# Data mode cannot be specified as an integer. When the stream access mode is
|
@@ -699,7 +679,6 @@
|
|
699
679
|
# methods for creating, reading, and writing files
|
700
680
|
# * Includes module FileTest, which provides dozens of additional methods.
|
701
681
|
#
|
702
|
-
#
|
703
682
|
# Here, class File provides methods that are useful for:
|
704
683
|
#
|
705
684
|
# * [Creating](rdoc-ref:File@Creating)
|
@@ -707,7 +686,6 @@
|
|
707
686
|
# * [Settings](rdoc-ref:File@Settings)
|
708
687
|
# * [Other](rdoc-ref:File@Other)
|
709
688
|
#
|
710
|
-
#
|
711
689
|
# ### Creating
|
712
690
|
#
|
713
691
|
# * ::new: Opens the file at the given path; returns the file.
|
@@ -717,7 +695,6 @@
|
|
717
695
|
# * ::mkfifo: Returns the FIFO file created at the given path.
|
718
696
|
# * ::symlink: Creates a symbolic link for the given file path.
|
719
697
|
#
|
720
|
-
#
|
721
698
|
# ### Querying
|
722
699
|
#
|
723
700
|
# *Paths*
|
@@ -744,7 +721,6 @@
|
|
744
721
|
# * #path (aliased as #to_path): Returns the string representation of the
|
745
722
|
# given path.
|
746
723
|
#
|
747
|
-
#
|
748
724
|
# *Times*
|
749
725
|
#
|
750
726
|
# * ::atime: Returns a Time for the most recent access to the given file.
|
@@ -758,7 +734,6 @@
|
|
758
734
|
# * #mtime: Returns a Time for the most recent data modification to the
|
759
735
|
# content of `self`.
|
760
736
|
#
|
761
|
-
#
|
762
737
|
# *Types*
|
763
738
|
#
|
764
739
|
# * ::blockdev?: Returns whether the file at the given path is a block device.
|
@@ -805,7 +780,6 @@
|
|
805
780
|
# * #lstat: Returns the File::Stat object for the last symbolic link in the
|
806
781
|
# path for `self`.
|
807
782
|
#
|
808
|
-
#
|
809
783
|
# *Contents*
|
810
784
|
#
|
811
785
|
# * ::empty? (aliased as ::zero?): Returns whether the file at the given path
|
@@ -815,7 +789,6 @@
|
|
815
789
|
# file is empty; otherwise returns the file size (bytes).
|
816
790
|
# * #size: Returns the size (bytes) of `self`.
|
817
791
|
#
|
818
|
-
#
|
819
792
|
# ### Settings
|
820
793
|
#
|
821
794
|
# * ::chmod: Changes permissions of the file at the given path.
|
@@ -829,7 +802,6 @@
|
|
829
802
|
# given paths.
|
830
803
|
# * #flock: Locks or unlocks `self`.
|
831
804
|
#
|
832
|
-
#
|
833
805
|
# ### Other
|
834
806
|
#
|
835
807
|
# * ::truncate: Truncates the file at the given file path to the given size.
|
@@ -1193,10 +1165,13 @@ class File < IO
|
|
1193
1165
|
#
|
1194
1166
|
# `*`
|
1195
1167
|
# : Matches all regular files
|
1168
|
+
#
|
1196
1169
|
# `c*`
|
1197
1170
|
# : Matches all files beginning with `c`
|
1171
|
+
#
|
1198
1172
|
# `*c`
|
1199
1173
|
# : Matches all files ending with `c`
|
1174
|
+
#
|
1200
1175
|
# `*c*`
|
1201
1176
|
# : Matches all files that have `c` in them (including at the beginning or
|
1202
1177
|
# end).
|
@@ -1205,19 +1180,24 @@ class File < IO
|
|
1205
1180
|
# To match hidden files (that start with a `.`) set the File::FNM_DOTMATCH
|
1206
1181
|
# flag.
|
1207
1182
|
#
|
1183
|
+
#
|
1208
1184
|
# `**`
|
1209
1185
|
# : Matches directories recursively or files expansively.
|
1210
1186
|
#
|
1187
|
+
#
|
1211
1188
|
# `?`
|
1212
1189
|
# : Matches any one character. Equivalent to `/.{1}/` in regexp.
|
1213
1190
|
#
|
1191
|
+
#
|
1214
1192
|
# `[set]`
|
1215
1193
|
# : Matches any one character in `set`. Behaves exactly like character sets
|
1216
1194
|
# in Regexp, including set negation (`[^a-z]`).
|
1217
1195
|
#
|
1196
|
+
#
|
1218
1197
|
# `\`
|
1219
1198
|
# : Escapes the next metacharacter.
|
1220
1199
|
#
|
1200
|
+
#
|
1221
1201
|
# `{a,b}`
|
1222
1202
|
# : Matches pattern a and pattern b if File::FNM_EXTGLOB flag is enabled.
|
1223
1203
|
# Behaves like a Regexp union (`(?:a|b)`).
|
@@ -1334,7 +1314,7 @@ class File < IO
|
|
1334
1314
|
#
|
1335
1315
|
# File.join("usr", "mail", "gumby") #=> "usr/mail/gumby"
|
1336
1316
|
#
|
1337
|
-
def self.join: (*
|
1317
|
+
def self.join: (*path) -> String
|
1338
1318
|
|
1339
1319
|
# <!--
|
1340
1320
|
# rdoc-file=file.c
|
@@ -1836,46 +1816,19 @@ class File < IO
|
|
1836
1816
|
# rdoc-file=file.c
|
1837
1817
|
# - flock(locking_constant) -> 0 or false
|
1838
1818
|
# -->
|
1839
|
-
# Locks or unlocks
|
1819
|
+
# Locks or unlocks file `self` according to the given `locking_constant`,
|
1840
1820
|
# a bitwise OR of the values in the table below.
|
1841
1821
|
# Not available on all platforms.
|
1842
1822
|
# Returns `false` if `File::LOCK_NB` is specified and the operation would have
|
1843
1823
|
# blocked;
|
1844
1824
|
# otherwise returns `0`.
|
1845
|
-
#
|
1846
|
-
#
|
1847
|
-
#
|
1848
|
-
#
|
1849
|
-
#
|
1850
|
-
#
|
1851
|
-
#
|
1852
|
-
# <th>Lock</th>
|
1853
|
-
# <th>Effect</th>
|
1854
|
-
# </tr>
|
1855
|
-
# <tr>
|
1856
|
-
# <td><tt>File::LOCK_EX</tt></td>
|
1857
|
-
# <td>Exclusive</td>
|
1858
|
-
# <td>Only one process may hold an exclusive lock for <tt>self</tt> at a time.</td>
|
1859
|
-
# </tr>
|
1860
|
-
# <tr>
|
1861
|
-
# <td><tt>File::LOCK_NB</tt></td>
|
1862
|
-
# <td>Non-blocking</td>
|
1863
|
-
# <td>
|
1864
|
-
# No blocking; may be combined with other <tt>File::LOCK_SH</tt> or <tt>File::LOCK_EX</tt>
|
1865
|
-
# using the bitwise OR operator <tt>|</tt>.
|
1866
|
-
# </td>
|
1867
|
-
# </tr>
|
1868
|
-
# <tr>
|
1869
|
-
# <td><tt>File::LOCK_SH</tt></td>
|
1870
|
-
# <td>Shared</td>
|
1871
|
-
# <td>Multiple processes may each hold a shared lock for <tt>self</tt> at the same time.</td>
|
1872
|
-
# </tr>
|
1873
|
-
# <tr>
|
1874
|
-
# <td><tt>File::LOCK_UN</tt></td>
|
1875
|
-
# <td>Unlock</td>
|
1876
|
-
# <td>Remove an existing lock held by this process.</td>
|
1877
|
-
# </tr>
|
1878
|
-
# </table>
|
1825
|
+
# Constant | Lock | Effect
|
1826
|
+
# ---------------|------------|--------------------------------------------------------------------------------------------------------------
|
1827
|
+
# +File::LOCK_EX+| Exclusive | Only one process may hold an exclusive lock for +self+ at a time.
|
1828
|
+
# +File::LOCK_NB+|Non-blocking|No blocking; may be combined with +File::LOCK_SH+ or +File::LOCK_EX+ using the bitwise OR operator <tt>|</tt>.
|
1829
|
+
# +File::LOCK_SH+| Shared | Multiple processes may each hold a shared lock for +self+ at the same time.
|
1830
|
+
# +File::LOCK_UN+| Unlock | Remove an existing lock held by this process.
|
1831
|
+
# Example:
|
1879
1832
|
# # Update a counter using an exclusive lock.
|
1880
1833
|
# # Don't use File::WRONLY because it truncates the file.
|
1881
1834
|
# File.open('counter', File::RDWR | File::CREAT, 0644) do |f|
|
@@ -2010,7 +1963,6 @@ File::Separator: String
|
|
2010
1963
|
# globbing](rdoc-ref:File::Constants@Filename+Globbing+Constants+-28File-3A-
|
2011
1964
|
# 3AFNM_-2A-29).
|
2012
1965
|
#
|
2013
|
-
#
|
2014
1966
|
# File constants defined for the local process may be retrieved with method
|
2015
1967
|
# File::Constants.constants:
|
2016
1968
|
#
|
@@ -2034,7 +1986,6 @@ File::Separator: String
|
|
2034
1986
|
# * StringIO.open.
|
2035
1987
|
# * StringIO#reopen.
|
2036
1988
|
#
|
2037
|
-
#
|
2038
1989
|
# ### Read/Write Access
|
2039
1990
|
#
|
2040
1991
|
# Read-write access for a stream may be specified by a file-access constant.
|
@@ -2045,7 +1996,7 @@ File::Separator: String
|
|
2045
1996
|
#
|
2046
1997
|
# #### File::RDONLY
|
2047
1998
|
#
|
2048
|
-
# Flag File::RDONLY specifies the
|
1999
|
+
# Flag File::RDONLY specifies the stream should be opened for reading only:
|
2049
2000
|
#
|
2050
2001
|
# filepath = '/tmp/t.tmp'
|
2051
2002
|
# f = File.new(filepath, File::RDONLY)
|
@@ -2133,7 +2084,6 @@ File::Separator: String
|
|
2133
2084
|
# * File::NOFOLLOW.
|
2134
2085
|
# * File::TMPFILE.
|
2135
2086
|
#
|
2136
|
-
#
|
2137
2087
|
# #### File::SYNC, File::RSYNC, and File::DSYNC
|
2138
2088
|
#
|
2139
2089
|
# Flag File::SYNC, File::RSYNC, or File::DSYNC specifies synchronization of I/O
|
@@ -2160,7 +2110,6 @@ File::Separator: String
|
|
2160
2110
|
# be flushed to the underlying storage device; this differs from File::SYNC,
|
2161
2111
|
# which requires that *metadata* also be synchronized.
|
2162
2112
|
#
|
2163
|
-
#
|
2164
2113
|
# Note that the behavior of these flags may vary slightly depending on the
|
2165
2114
|
# operating system and filesystem being used. Additionally, using these flags
|
2166
2115
|
# can have an impact on performance due to the synchronous nature of the I/O
|
@@ -2214,11 +2163,13 @@ File::Separator: String
|
|
2214
2163
|
#
|
2215
2164
|
# Flag File::BINARY specifies that the stream is to be accessed in binary mode.
|
2216
2165
|
#
|
2217
|
-
# #### File::SHARE_DELETE
|
2166
|
+
# #### File::SHARE_DELETE
|
2218
2167
|
#
|
2219
2168
|
# Flag File::SHARE_DELETE enables other processes to open the stream with delete
|
2220
2169
|
# access.
|
2221
2170
|
#
|
2171
|
+
# Windows only.
|
2172
|
+
#
|
2222
2173
|
# If the stream is opened for (local) delete access without File::SHARE_DELETE,
|
2223
2174
|
# and another process attempts to open it with delete access, the attempt fails
|
2224
2175
|
# and the stream is not opened for that process.
|
@@ -2257,7 +2208,6 @@ File::Separator: String
|
|
2257
2208
|
# * Pathname.glob.
|
2258
2209
|
# * Pathname#glob.
|
2259
2210
|
#
|
2260
|
-
#
|
2261
2211
|
# The constants are:
|
2262
2212
|
#
|
2263
2213
|
# #### File::FNM_CASEFOLD
|
@@ -2290,9 +2240,11 @@ File::Separator: String
|
|
2290
2240
|
# Flag File::FNM_PATHNAME specifies that patterns `'*'` and `'?'` do not match
|
2291
2241
|
# the directory separator (the value of constant File::SEPARATOR).
|
2292
2242
|
#
|
2293
|
-
# #### File::FNM_SHORTNAME
|
2243
|
+
# #### File::FNM_SHORTNAME
|
2244
|
+
#
|
2245
|
+
# Flag File::FNM_SHORTNAME allows patterns to match short names if they exist.
|
2294
2246
|
#
|
2295
|
-
#
|
2247
|
+
# Windows only.
|
2296
2248
|
#
|
2297
2249
|
# #### File::FNM_SYSCASE
|
2298
2250
|
#
|
@@ -2439,8 +2391,7 @@ File::Constants::RDWR: Integer
|
|
2439
2391
|
File::Constants::RSYNC: Integer
|
2440
2392
|
|
2441
2393
|
# <!-- rdoc-file=file.c -->
|
2442
|
-
# [File::SHARE_DELETE](rdoc-ref:File::Constants@File-3A-3ASHARE_DELETE
|
2443
|
-
# s+Only-29)
|
2394
|
+
# [File::SHARE_DELETE](rdoc-ref:File::Constants@File-3A-3ASHARE_DELETE)
|
2444
2395
|
#
|
2445
2396
|
File::Constants::SHARE_DELETE: Integer
|
2446
2397
|
|
data/core/float.rbs
CHANGED
@@ -10,23 +10,21 @@
|
|
10
10
|
# ys-floats-imprecise
|
11
11
|
# * https://en.wikipedia.org/wiki/Floating_point#Accuracy_problems
|
12
12
|
#
|
13
|
-
#
|
14
13
|
# You can create a Float object explicitly with:
|
15
14
|
#
|
16
15
|
# * A [floating-point literal](rdoc-ref:syntax/literals.rdoc@Float+Literals).
|
17
16
|
#
|
18
|
-
#
|
19
17
|
# You can convert certain objects to Floats with:
|
20
18
|
#
|
21
19
|
# * Method #Float.
|
22
20
|
#
|
23
|
-
#
|
24
21
|
# ## What's Here
|
25
22
|
#
|
26
23
|
# First, what's elsewhere. Class Float:
|
27
24
|
#
|
28
|
-
# * Inherits from [class Numeric](rdoc-ref:Numeric@What-27s+Here)
|
29
|
-
#
|
25
|
+
# * Inherits from [class Numeric](rdoc-ref:Numeric@What-27s+Here) and [class
|
26
|
+
# Object](rdoc-ref:Object@What-27s+Here).
|
27
|
+
# * Includes [module Comparable](rdoc-ref:Comparable@What-27s+Here).
|
30
28
|
#
|
31
29
|
# Here, class Float provides methods for:
|
32
30
|
#
|
@@ -34,7 +32,6 @@
|
|
34
32
|
# * [Comparing](rdoc-ref:Float@Comparing)
|
35
33
|
# * [Converting](rdoc-ref:Float@Converting)
|
36
34
|
#
|
37
|
-
#
|
38
35
|
# ### Querying
|
39
36
|
#
|
40
37
|
# * #finite?: Returns whether `self` is finite.
|
@@ -42,7 +39,6 @@
|
|
42
39
|
# * #infinite?: Returns whether `self` is infinite.
|
43
40
|
# * #nan?: Returns whether `self` is a NaN (not-a-number).
|
44
41
|
#
|
45
|
-
#
|
46
42
|
# ### Comparing
|
47
43
|
#
|
48
44
|
# * #<: Returns whether `self` is less than the given value.
|
@@ -54,7 +50,6 @@
|
|
54
50
|
# * #>: Returns whether `self` is greater than the given value.
|
55
51
|
# * #>=: Returns whether `self` is greater than or equal to the given value.
|
56
52
|
#
|
57
|
-
#
|
58
53
|
# ### Converting
|
59
54
|
#
|
60
55
|
# * #% (aliased as #modulo): Returns `self` modulo the given value.
|
@@ -241,7 +236,6 @@ class Float < Numeric
|
|
241
236
|
# * 1, if `self` is greater than `other`.
|
242
237
|
# * `nil`, if the two values are incommensurate.
|
243
238
|
#
|
244
|
-
#
|
245
239
|
# Examples:
|
246
240
|
#
|
247
241
|
# 2.0 <=> 2 # => 0
|
@@ -351,33 +345,58 @@ class Float < Numeric
|
|
351
345
|
# rdoc-file=numeric.c
|
352
346
|
# - ceil(ndigits = 0) -> float or integer
|
353
347
|
# -->
|
354
|
-
# Returns
|
355
|
-
#
|
356
|
-
#
|
357
|
-
#
|
358
|
-
#
|
359
|
-
#
|
348
|
+
# Returns a numeric that is a "ceiling" value for `self`,
|
349
|
+
# as specified by the given `ndigits`,
|
350
|
+
# which must be an
|
351
|
+
# [integer-convertible
|
352
|
+
# object](rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects).
|
353
|
+
# When `ndigits` is positive, returns a Float with `ndigits`
|
354
|
+
# decimal digits after the decimal point
|
355
|
+
# (as available, but no fewer than 1):
|
360
356
|
# f = 12345.6789
|
361
|
-
#
|
362
|
-
#
|
363
|
-
#
|
364
|
-
#
|
365
|
-
#
|
366
|
-
#
|
367
|
-
#
|
368
|
-
#
|
369
|
-
#
|
370
|
-
#
|
371
|
-
#
|
372
|
-
#
|
373
|
-
#
|
374
|
-
#
|
375
|
-
#
|
376
|
-
#
|
377
|
-
#
|
378
|
-
#
|
379
|
-
#
|
380
|
-
#
|
357
|
+
# f.ceil(1) # => 12345.7
|
358
|
+
# f.ceil(3) # => 12345.679
|
359
|
+
# f.ceil(30) # => 12345.6789
|
360
|
+
# f = -12345.6789
|
361
|
+
# f.ceil(1) # => -12345.6
|
362
|
+
# f.ceil(3) # => -12345.678
|
363
|
+
# f.ceil(30) # => -12345.6789
|
364
|
+
# f = 0.0
|
365
|
+
# f.ceil(1) # => 0.0
|
366
|
+
# f.ceil(100) # => 0.0
|
367
|
+
#
|
368
|
+
# When `ndigits` is non-positive,
|
369
|
+
# returns an Integer based on a computed granularity:
|
370
|
+
# * The granularity is `10 ** ndigits.abs`.
|
371
|
+
# * The returned value is the largest multiple of the granularity
|
372
|
+
# that is less than or equal to `self`.
|
373
|
+
# Examples with positive `self`:
|
374
|
+
# ndigits|Granularity|12345.6789.ceil(ndigits)
|
375
|
+
# -------|-----------|------------------------
|
376
|
+
# 0| 1| 12346
|
377
|
+
# -1| 10| 12350
|
378
|
+
# -2| 100| 12400
|
379
|
+
# -3| 1000| 13000
|
380
|
+
# -4| 10000| 20000
|
381
|
+
# -5| 100000| 100000
|
382
|
+
# Examples with negative `self`:
|
383
|
+
# ndigits|Granularity|-12345.6789.ceil(ndigits)
|
384
|
+
# -------|-----------|-------------------------
|
385
|
+
# 0| 1| -12345
|
386
|
+
# -1| 10| -12340
|
387
|
+
# -2| 100| -12300
|
388
|
+
# -3| 1000| -12000
|
389
|
+
# -4| 10000| -10000
|
390
|
+
# -5| 100000| 0
|
391
|
+
# When `self` is zero and `ndigits` is non-positive,
|
392
|
+
# returns Integer zero:
|
393
|
+
# 0.0.ceil(0) # => 0
|
394
|
+
# 0.0.ceil(-1) # => 0
|
395
|
+
# 0.0.ceil(-2) # => 0
|
396
|
+
#
|
397
|
+
# Note that the limited precision of floating-point arithmetic
|
398
|
+
# may lead to surprising results:
|
399
|
+
# (2.1 / 0.7).ceil #=> 4 # Not 3 (because 2.1 / 0.7 # => 3.0000000000000004, not 3.0)
|
381
400
|
#
|
382
401
|
# Related: Float#floor.
|
383
402
|
#
|
@@ -498,33 +517,59 @@ class Float < Numeric
|
|
498
517
|
# rdoc-file=numeric.c
|
499
518
|
# - floor(ndigits = 0) -> float or integer
|
500
519
|
# -->
|
501
|
-
# Returns
|
502
|
-
# `ndigits
|
503
|
-
#
|
504
|
-
#
|
505
|
-
#
|
506
|
-
#
|
507
|
-
#
|
508
|
-
#
|
509
|
-
#
|
510
|
-
# f =
|
511
|
-
#
|
512
|
-
#
|
513
|
-
#
|
514
|
-
#
|
515
|
-
#
|
516
|
-
#
|
520
|
+
# Returns a float or integer that is a "floor" value for `self`,
|
521
|
+
# as specified by `ndigits`,
|
522
|
+
# which must be an
|
523
|
+
# [integer-convertible
|
524
|
+
# object](rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects).
|
525
|
+
# When `self` is zero,
|
526
|
+
# returns a zero value:
|
527
|
+
# a float if `ndigits` is positive,
|
528
|
+
# an integer otherwise:
|
529
|
+
# f = 0.0 # => 0.0
|
530
|
+
# f.floor(20) # => 0.0
|
531
|
+
# f.floor(0) # => 0
|
532
|
+
# f.floor(-20) # => 0
|
533
|
+
#
|
534
|
+
# When `self` is non-zero and `ndigits` is positive, returns a float with
|
535
|
+
# `ndigits`
|
536
|
+
# digits after the decimal point (as available):
|
517
537
|
# f = 12345.6789
|
518
|
-
#
|
519
|
-
#
|
520
|
-
#
|
521
|
-
#
|
522
|
-
#
|
523
|
-
#
|
524
|
-
#
|
525
|
-
#
|
526
|
-
#
|
527
|
-
#
|
538
|
+
# f.floor(1) # => 12345.6
|
539
|
+
# f.floor(3) # => 12345.678
|
540
|
+
# f.floor(30) # => 12345.6789
|
541
|
+
# f = -12345.6789
|
542
|
+
# f.floor(1) # => -12345.7
|
543
|
+
# f.floor(3) # => -12345.679
|
544
|
+
# f.floor(30) # => -12345.6789
|
545
|
+
#
|
546
|
+
# When `self` is non-zero and `ndigits` is non-positive,
|
547
|
+
# returns an integer value based on a computed granularity:
|
548
|
+
# * The granularity is `10 ** ndigits.abs`.
|
549
|
+
# * The returned value is the largest multiple of the granularity
|
550
|
+
# that is less than or equal to `self`.
|
551
|
+
# Examples with positive `self`:
|
552
|
+
# ndigits|Granularity|12345.6789.floor(ndigits)
|
553
|
+
# -------|-----------|-------------------------
|
554
|
+
# 0| 1| 12345
|
555
|
+
# -1| 10| 12340
|
556
|
+
# -2| 100| 12300
|
557
|
+
# -3| 1000| 12000
|
558
|
+
# -4| 10000| 10000
|
559
|
+
# -5| 100000| 0
|
560
|
+
# Examples with negative `self`:
|
561
|
+
# ndigits|Granularity|-12345.6789.floor(ndigits)
|
562
|
+
# -------|-----------|--------------------------
|
563
|
+
# 0| 1| -12346
|
564
|
+
# -1| 10| -12350
|
565
|
+
# -2| 100| -12400
|
566
|
+
# -3| 1000| -13000
|
567
|
+
# -4| 10000| -20000
|
568
|
+
# -5| 100000| -100000
|
569
|
+
# -6| 1000000| -1000000
|
570
|
+
# Note that the limited precision of floating-point arithmetic
|
571
|
+
# may lead to surprising results:
|
572
|
+
# (0.3 / 0.1).floor # => 2 # Not 3, (because (0.3 / 0.1) # => 2.9999999999999996, not 3.0)
|
528
573
|
#
|
529
574
|
# Related: Float#ceil.
|
530
575
|
#
|
@@ -557,7 +602,6 @@ class Float < Numeric
|
|
557
602
|
# * -1 if `self` is `-Infinity`.
|
558
603
|
# * `nil`, otherwise.
|
559
604
|
#
|
560
|
-
#
|
561
605
|
# Examples:
|
562
606
|
#
|
563
607
|
# f = 1.0/0.0 # => Infinity
|
@@ -576,14 +620,19 @@ class Float < Numeric
|
|
576
620
|
# of `self`, the string representation may contain:
|
577
621
|
#
|
578
622
|
# * A fixed-point number.
|
623
|
+
# 3.14.to_s # => "3.14"
|
624
|
+
#
|
579
625
|
# * A number in "scientific notation" (containing an exponent).
|
626
|
+
# (10.1**50).to_s # => "1.644631821843879e+50"
|
627
|
+
#
|
580
628
|
# * 'Infinity'.
|
629
|
+
# (10.1**500).to_s # => "Infinity"
|
630
|
+
#
|
581
631
|
# * '-Infinity'.
|
582
|
-
#
|
632
|
+
# (-10.1**500).to_s # => "-Infinity"
|
583
633
|
#
|
584
|
-
#
|
585
|
-
#
|
586
|
-
# (-10.1**500).to_s # => "-Infinity" (0.0/0.0).to_s # => "NaN"
|
634
|
+
# * 'NaN' (indicating not-a-number).
|
635
|
+
# (0.0/0.0).to_s # => "NaN"
|
587
636
|
#
|
588
637
|
alias inspect to_s
|
589
638
|
|
@@ -798,7 +847,7 @@ class Float < Numeric
|
|
798
847
|
|
799
848
|
# <!--
|
800
849
|
# rdoc-file=numeric.c
|
801
|
-
# - round(ndigits = 0, half: :up
|
850
|
+
# - round(ndigits = 0, half: :up) -> integer or float
|
802
851
|
# -->
|
803
852
|
# Returns `self` rounded to the nearest value with a precision of `ndigits`
|
804
853
|
# decimal digits.
|
@@ -844,7 +893,6 @@ class Float < Numeric
|
|
844
893
|
# 3.5.round(half: :even) # => 4
|
845
894
|
# (-2.5).round(half: :even) # => -2
|
846
895
|
#
|
847
|
-
#
|
848
896
|
# Raises and exception if the value for `half` is invalid.
|
849
897
|
#
|
850
898
|
# Related: Float#truncate.
|
@@ -926,14 +974,19 @@ class Float < Numeric
|
|
926
974
|
# of `self`, the string representation may contain:
|
927
975
|
#
|
928
976
|
# * A fixed-point number.
|
977
|
+
# 3.14.to_s # => "3.14"
|
978
|
+
#
|
929
979
|
# * A number in "scientific notation" (containing an exponent).
|
980
|
+
# (10.1**50).to_s # => "1.644631821843879e+50"
|
981
|
+
#
|
930
982
|
# * 'Infinity'.
|
983
|
+
# (10.1**500).to_s # => "Infinity"
|
984
|
+
#
|
931
985
|
# * '-Infinity'.
|
932
|
-
#
|
986
|
+
# (-10.1**500).to_s # => "-Infinity"
|
933
987
|
#
|
934
|
-
#
|
935
|
-
#
|
936
|
-
# (-10.1**500).to_s # => "-Infinity" (0.0/0.0).to_s # => "NaN"
|
988
|
+
# * 'NaN' (indicating not-a-number).
|
989
|
+
# (0.0/0.0).to_s # => "NaN"
|
937
990
|
#
|
938
991
|
def to_s: () -> String
|
939
992
|
|