rbs 3.10.0.pre.2 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/c-check.yml +1 -1
- data/.github/workflows/comments.yml +2 -2
- data/.github/workflows/ruby.yml +7 -7
- data/CHANGELOG.md +49 -0
- data/core/array.rbs +56 -3
- data/core/complex.rbs +32 -21
- data/core/encoding.rbs +3 -7
- data/core/enumerable.rbs +1 -1
- data/core/enumerator.rbs +18 -1
- data/core/fiber.rbs +2 -1
- data/core/file.rbs +1 -1
- data/core/file_test.rbs +1 -1
- data/core/float.rbs +208 -21
- data/core/gc.rbs +4 -9
- data/core/hash.rbs +4 -4
- data/core/integer.rbs +78 -38
- data/core/io/buffer.rbs +18 -7
- data/core/io.rbs +8 -8
- data/core/kernel.rbs +8 -8
- data/core/module.rbs +17 -6
- data/core/numeric.rbs +8 -8
- data/core/object_space.rbs +13 -20
- data/core/pathname.rbs +2 -3
- data/core/ractor.rbs +4 -4
- data/core/range.rbs +1 -1
- data/core/rational.rbs +37 -24
- data/core/rbs/unnamed/argf.rbs +1 -1
- data/core/regexp.rbs +3 -3
- data/core/ruby.rbs +53 -0
- data/core/rubygems/version.rbs +2 -3
- data/core/set.rbs +86 -64
- data/core/string.rbs +275 -141
- data/core/thread.rbs +9 -9
- data/core/trace_point.rbs +7 -4
- data/lib/rbs/test/type_check.rb +1 -0
- data/lib/rbs/version.rb +1 -1
- data/lib/rdoc/discover.rb +1 -1
- data/stdlib/bigdecimal/0/big_decimal.rbs +100 -82
- data/stdlib/bigdecimal-math/0/big_math.rbs +169 -8
- data/stdlib/date/0/date.rbs +67 -59
- data/stdlib/date/0/date_time.rbs +1 -1
- data/stdlib/json/0/json.rbs +1 -0
- data/stdlib/objspace/0/objspace.rbs +1 -1
- data/stdlib/openssl/0/openssl.rbs +150 -80
- data/stdlib/psych/0/psych.rbs +3 -3
- data/stdlib/stringio/0/stringio.rbs +796 -37
- data/stdlib/strscan/0/string_scanner.rbs +1 -1
- data/stdlib/tempfile/0/tempfile.rbs +2 -2
- data/stdlib/time/0/time.rbs +1 -1
- data/stdlib/timeout/0/timeout.rbs +63 -7
- data/stdlib/uri/0/generic.rbs +1 -1
- metadata +3 -2
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
# * `match_values_cleared?(scanner)`:
|
|
29
29
|
# Returns whether the scanner's [match
|
|
30
30
|
# values](rdoc-ref:StringScanner@Match+Values) are cleared.
|
|
31
|
-
# See examples at [helper methods](
|
|
31
|
+
# See examples at [helper methods](helper_methods.md).
|
|
32
32
|
# ## The `StringScanner` Object
|
|
33
33
|
# This code creates a `StringScanner` object
|
|
34
34
|
# (we'll call it simply a *scanner*),
|
|
@@ -248,8 +248,8 @@ class Tempfile < File
|
|
|
248
248
|
#
|
|
249
249
|
# Implementation note:
|
|
250
250
|
#
|
|
251
|
-
# The keyword argument
|
|
252
|
-
# on Windows. O_TMPFILE is used on Linux.
|
|
251
|
+
# The keyword argument `anonymous=true` is implemented using `FILE_SHARE_DELETE`
|
|
252
|
+
# on Windows. `O_TMPFILE` is used on Linux.
|
|
253
253
|
#
|
|
254
254
|
# Related: Tempfile.new.
|
|
255
255
|
#
|
data/stdlib/time/0/time.rbs
CHANGED
|
@@ -26,7 +26,7 @@ module Timeout
|
|
|
26
26
|
# rdoc-file=lib/timeout.rb
|
|
27
27
|
# - timeout(sec, klass = nil, message = nil) { |sec| ... }
|
|
28
28
|
# -->
|
|
29
|
-
# Perform an operation in a block, raising an
|
|
29
|
+
# Perform an operation in a block, raising an exception if it takes longer than
|
|
30
30
|
# `sec` seconds to complete.
|
|
31
31
|
#
|
|
32
32
|
# `sec`
|
|
@@ -45,12 +45,20 @@ module Timeout
|
|
|
45
45
|
#
|
|
46
46
|
#
|
|
47
47
|
# Returns the result of the block **if** the block completed before `sec`
|
|
48
|
-
# seconds, otherwise
|
|
48
|
+
# seconds, otherwise raises an exception, based on the value of `klass`.
|
|
49
49
|
#
|
|
50
|
-
# The exception
|
|
51
|
-
#
|
|
52
|
-
#
|
|
53
|
-
#
|
|
50
|
+
# The exception raised to terminate the given block is the given `klass`, or
|
|
51
|
+
# Timeout::ExitException if `klass` is not given. The reason for that behavior
|
|
52
|
+
# is that Timeout::Error inherits from RuntimeError and might be caught
|
|
53
|
+
# unexpectedly by `rescue`. Timeout::ExitException inherits from Exception so it
|
|
54
|
+
# will only be rescued by `rescue Exception`. Note that the
|
|
55
|
+
# Timeout::ExitException is translated to a Timeout::Error once it reaches the
|
|
56
|
+
# Timeout.timeout call, so outside that call it will be a Timeout::Error.
|
|
57
|
+
#
|
|
58
|
+
# In general, be aware that the code block may rescue the exception, and in such
|
|
59
|
+
# a case not respect the timeout. Also, the block can use `ensure` to prevent
|
|
60
|
+
# the handling of the exception. For those reasons, this method cannot be relied
|
|
61
|
+
# on to enforce timeouts for untrusted blocks.
|
|
54
62
|
#
|
|
55
63
|
# If a scheduler is defined, it will be used to handle the timeout by invoking
|
|
56
64
|
# Scheduler#timeout_after.
|
|
@@ -59,11 +67,59 @@ module Timeout
|
|
|
59
67
|
# Timeout` into your classes so they have a #timeout method, as well as a module
|
|
60
68
|
# method, so you can call it directly as Timeout.timeout().
|
|
61
69
|
#
|
|
70
|
+
# #### Ensuring the exception does not fire inside ensure blocks
|
|
71
|
+
#
|
|
72
|
+
# When using Timeout.timeout it can be desirable to ensure the timeout exception
|
|
73
|
+
# does not fire inside an `ensure` block. The simplest and best way to do so it
|
|
74
|
+
# to put the Timeout.timeout call inside the body of the begin/ensure/end:
|
|
75
|
+
#
|
|
76
|
+
# begin
|
|
77
|
+
# Timeout.timeout(sec) { some_long_operation }
|
|
78
|
+
# ensure
|
|
79
|
+
# cleanup # safe, cannot be interrupt by timeout
|
|
80
|
+
# end
|
|
81
|
+
#
|
|
82
|
+
# If that is not feasible, e.g. if there are `ensure` blocks inside
|
|
83
|
+
# `some_long_operation`, they need to not be interrupted by timeout, and it's
|
|
84
|
+
# not possible to move these ensure blocks outside, one can use
|
|
85
|
+
# Thread.handle_interrupt to delay the timeout exception like so:
|
|
86
|
+
#
|
|
87
|
+
# Thread.handle_interrupt(Timeout::Error => :never) {
|
|
88
|
+
# Timeout.timeout(sec, Timeout::Error) do
|
|
89
|
+
# setup # timeout cannot happen here, no matter how long it takes
|
|
90
|
+
# Thread.handle_interrupt(Timeout::Error => :immediate) {
|
|
91
|
+
# some_long_operation # timeout can happen here
|
|
92
|
+
# }
|
|
93
|
+
# ensure
|
|
94
|
+
# cleanup # timeout cannot happen here, no matter how long it takes
|
|
95
|
+
# end
|
|
96
|
+
# }
|
|
97
|
+
#
|
|
98
|
+
# An important thing to note is the need to pass an exception klass to
|
|
99
|
+
# Timeout.timeout, otherwise it does not work. Specifically, using
|
|
100
|
+
# +Thread.handle_interrupt(Timeout::ExitException => ...)+ is unsupported and
|
|
101
|
+
# causes subtle errors like raising the wrong exception outside the block, do
|
|
102
|
+
# not use that.
|
|
103
|
+
#
|
|
104
|
+
# Note that Thread.handle_interrupt is somewhat dangerous because if setup or
|
|
105
|
+
# cleanup hangs then the current thread will hang too and the timeout will never
|
|
106
|
+
# fire. Also note the block might run for longer than `sec` seconds: e.g.
|
|
107
|
+
# some_long_operation executes for `sec` seconds + whatever time cleanup takes.
|
|
108
|
+
#
|
|
109
|
+
# If you want the timeout to only happen on blocking operations one can use
|
|
110
|
+
# :on_blocking instead of :immediate. However, that means if the block uses no
|
|
111
|
+
# blocking operations after `sec` seconds, the block will not be interrupted.
|
|
112
|
+
# ----
|
|
113
|
+
# <!--
|
|
114
|
+
# rdoc-file=lib/timeout.rb
|
|
115
|
+
# - timeout(*args, &block)
|
|
116
|
+
# -->
|
|
117
|
+
#
|
|
62
118
|
def self?.timeout: [T] (Numeric? sec, ?singleton(Exception) klass, ?String message) { (Numeric sec) -> T } -> T
|
|
63
119
|
end
|
|
64
120
|
|
|
65
121
|
# <!-- rdoc-file=lib/timeout.rb -->
|
|
66
|
-
# Internal
|
|
122
|
+
# Internal exception raised to when a timeout is triggered.
|
|
67
123
|
#
|
|
68
124
|
class Timeout::ExitException < Exception
|
|
69
125
|
end
|
data/stdlib/uri/0/generic.rbs
CHANGED
|
@@ -424,7 +424,7 @@ module URI
|
|
|
424
424
|
#
|
|
425
425
|
# uri = URI.parse("http://john:S3nsit1ve@my.example.com")
|
|
426
426
|
# uri.user = "sam"
|
|
427
|
-
# uri.to_s #=> "http://sam
|
|
427
|
+
# uri.to_s #=> "http://sam@my.example.com"
|
|
428
428
|
#
|
|
429
429
|
def user=: (String? user) -> String?
|
|
430
430
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rbs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.10.0
|
|
4
|
+
version: 3.10.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Soutaro Matsumoto
|
|
@@ -106,6 +106,7 @@ files:
|
|
|
106
106
|
- core/rbs/unnamed/random.rbs
|
|
107
107
|
- core/refinement.rbs
|
|
108
108
|
- core/regexp.rbs
|
|
109
|
+
- core/ruby.rbs
|
|
109
110
|
- core/ruby_vm.rbs
|
|
110
111
|
- core/rubygems/basic_specification.rbs
|
|
111
112
|
- core/rubygems/config_file.rbs
|
|
@@ -561,7 +562,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
561
562
|
- !ruby/object:Gem::Version
|
|
562
563
|
version: '0'
|
|
563
564
|
requirements: []
|
|
564
|
-
rubygems_version: 4.0.
|
|
565
|
+
rubygems_version: 4.0.2
|
|
565
566
|
specification_version: 4
|
|
566
567
|
summary: Type signature for Ruby.
|
|
567
568
|
test_files: []
|