rbs 3.8.0.pre.1 → 3.8.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/.github/workflows/comments.yml +3 -3
- data/.github/workflows/ruby.yml +7 -7
- data/.rubocop.yml +7 -0
- data/CHANGELOG.md +30 -0
- data/core/array.rbs +64 -62
- data/core/complex.rbs +1 -1
- data/core/encoding.rbs +0 -26
- data/core/errors.rbs +4 -0
- data/core/exception.rbs +149 -40
- data/core/file.rbs +1 -8
- data/core/gc.rbs +21 -3
- data/core/hash.rbs +2 -2
- data/core/io.rbs +2 -2
- data/core/kernel.rbs +58 -16
- data/core/nil_class.rbs +3 -0
- data/core/numeric.rbs +1 -1
- data/core/proc.rbs +80 -10
- data/core/ractor.rbs +20 -0
- data/core/regexp.rbs +6 -4
- data/core/ruby_vm.rbs +9 -9
- data/core/rubygems/errors.rbs +3 -1
- data/core/rubygems/rubygems.rbs +3 -1
- data/core/string.rbs +132 -130
- data/core/time.rbs +5 -1
- data/core/trace_point.rbs +108 -113
- data/ext/rbs_extension/parser.c +1 -1
- data/lib/rbs/types.rb +2 -1
- data/lib/rbs/version.rb +1 -1
- data/stdlib/date/0/date.rbs +23 -23
- data/stdlib/monitor/0/monitor.rbs +13 -4
- data/stdlib/net-http/0/net-http.rbs +20 -29
- data/stdlib/rdoc/0/rdoc.rbs +12 -6
- data/stdlib/resolv/0/resolv.rbs +5 -1
- data/stdlib/securerandom/0/securerandom.rbs +7 -0
- data/stdlib/socket/0/socket.rbs +9 -28
- data/stdlib/socket/0/tcp_socket.rbs +8 -30
- data/stdlib/tmpdir/0/tmpdir.rbs +2 -2
- metadata +3 -4
data/core/regexp.rbs
CHANGED
@@ -836,8 +836,10 @@
|
|
836
836
|
# These are also commonly used:
|
837
837
|
#
|
838
838
|
# * `/\p{Emoji}/`: Unicode emoji.
|
839
|
-
# * `/\p{Graph}/`:
|
840
|
-
#
|
839
|
+
# * `/\p{Graph}/`: Characters excluding `/\p{Cntrl}/` and `/\p{Space}/`. Note
|
840
|
+
# that invisible characters under the Unicode
|
841
|
+
# ["Format"](https://www.compart.com/en/unicode/category/Cf) category are
|
842
|
+
# included.
|
841
843
|
# * `/\p{Word}/`: A member in one of these Unicode character categories (see
|
842
844
|
# below) or having one of these Unicode properties:
|
843
845
|
#
|
@@ -897,7 +899,7 @@
|
|
897
899
|
# * [Nl, Letter_Number](https://www.compart.com/en/unicode/category/Nl).
|
898
900
|
# * [No, Other_Number](https://www.compart.com/en/unicode/category/No).
|
899
901
|
#
|
900
|
-
#
|
902
|
+
# Punctuation:
|
901
903
|
#
|
902
904
|
# * `P`, `Punctuation`: `Pc`, `Pd`, `Pe`, `Pf`, `Pi`, `Po`, or `Ps`.
|
903
905
|
# * [Pc,
|
@@ -1603,7 +1605,7 @@ class Regexp
|
|
1603
1605
|
# `self`:
|
1604
1606
|
#
|
1605
1607
|
# * Is a regexp literal; see [Regexp
|
1606
|
-
# Literals](rdoc-ref:literals.rdoc@Regexp+Literals).
|
1608
|
+
# Literals](rdoc-ref:syntax/literals.rdoc@Regexp+Literals).
|
1607
1609
|
# * Does not contain interpolations; see [Regexp
|
1608
1610
|
# interpolation](rdoc-ref:Regexp@Interpolation+Mode).
|
1609
1611
|
# * Is at the left of the expression.
|
data/core/ruby_vm.rbs
CHANGED
@@ -591,7 +591,7 @@ module RubyVM::AbstractSyntaxTree
|
|
591
591
|
|
592
592
|
# <!-- rdoc-file=ast.rb -->
|
593
593
|
# RubyVM::AbstractSyntaxTree::Location instances are created by
|
594
|
-
# RubyVM::AbstractSyntaxTree#locations.
|
594
|
+
# RubyVM::AbstractSyntaxTree::Node#locations.
|
595
595
|
#
|
596
596
|
# This class is MRI specific.
|
597
597
|
#
|
@@ -688,14 +688,14 @@ module RubyVM::YJIT
|
|
688
688
|
# Enable YJIT compilation. `stats` option decides whether to enable YJIT stats
|
689
689
|
# or not. `compilation_log` decides
|
690
690
|
# whether to enable YJIT compilation logging or not.
|
691
|
-
# `stats`:
|
692
|
-
#
|
693
|
-
#
|
694
|
-
#
|
695
|
-
# `log`:
|
696
|
-
#
|
697
|
-
#
|
698
|
-
#
|
691
|
+
# * `stats`:
|
692
|
+
# * `false`: Don't enable stats.
|
693
|
+
# * `true`: Enable stats. Print stats at exit.
|
694
|
+
# * `:quiet`: Enable stats. Do not print stats at exit.
|
695
|
+
# * `log`:
|
696
|
+
# * `false`: Don't enable the log.
|
697
|
+
# * `true`: Enable the log. Print log at exit.
|
698
|
+
# * `:quiet`: Enable the log. Do not print log at exit.
|
699
699
|
#
|
700
700
|
def self.enable: (?stats: false | true | :quiet) -> void
|
701
701
|
|
data/core/rubygems/errors.rbs
CHANGED
data/core/rubygems/rubygems.rbs
CHANGED
data/core/string.rbs
CHANGED
@@ -16,12 +16,12 @@
|
|
16
16
|
# * Method #String.
|
17
17
|
#
|
18
18
|
# Some `String` methods modify `self`. Typically, a method whose name ends with
|
19
|
-
# `!` modifies `self` and returns `self`; often a similarly named method
|
19
|
+
# `!` modifies `self` and returns `self`; often, a similarly named method
|
20
20
|
# (without the `!`) returns a new string.
|
21
21
|
#
|
22
|
-
# In general, if
|
23
|
-
# mutates and the non-bang
|
24
|
-
# mutate, such as String#replace.
|
22
|
+
# In general, if both bang and non-bang versions of a method exist, the bang
|
23
|
+
# method mutates and the non-bang method does not. However, a method without a
|
24
|
+
# bang can also mutate, such as String#replace.
|
25
25
|
#
|
26
26
|
# ## Substitution Methods
|
27
27
|
#
|
@@ -36,59 +36,58 @@
|
|
36
36
|
#
|
37
37
|
# Each of these methods takes:
|
38
38
|
#
|
39
|
-
# * A first argument, `pattern` (
|
39
|
+
# * A first argument, `pattern` (String or Regexp), that specifies the
|
40
40
|
# substring(s) to be replaced.
|
41
41
|
#
|
42
|
-
# * Either of
|
42
|
+
# * Either of the following:
|
43
43
|
#
|
44
|
-
# * A second argument, `replacement` (
|
44
|
+
# * A second argument, `replacement` (String or Hash), that determines the
|
45
45
|
# replacing string.
|
46
46
|
# * A block that will determine the replacing string.
|
47
47
|
#
|
48
|
-
# The examples in this section mostly use
|
49
|
-
# the principles illustrated apply to all four substitution methods.
|
48
|
+
# The examples in this section mostly use the String#sub and String#gsub
|
49
|
+
# methods; the principles illustrated apply to all four substitution methods.
|
50
50
|
#
|
51
51
|
# **Argument `pattern`**
|
52
52
|
#
|
53
53
|
# Argument `pattern` is commonly a regular expression:
|
54
54
|
#
|
55
55
|
# s = 'hello'
|
56
|
-
# s.sub(/[aeiou]/, '*')# => "h*llo"
|
56
|
+
# s.sub(/[aeiou]/, '*') # => "h*llo"
|
57
57
|
# s.gsub(/[aeiou]/, '*') # => "h*ll*"
|
58
|
-
# s.gsub(/[aeiou]/, '')# => "hll"
|
59
|
-
# s.sub(/ell/, 'al')
|
60
|
-
# s.gsub(/xyzzy/, '*')
|
58
|
+
# s.gsub(/[aeiou]/, '') # => "hll"
|
59
|
+
# s.sub(/ell/, 'al') # => "halo"
|
60
|
+
# s.gsub(/xyzzy/, '*') # => "hello"
|
61
61
|
# 'THX1138'.gsub(/\d+/, '00') # => "THX00"
|
62
62
|
#
|
63
63
|
# When `pattern` is a string, all its characters are treated as ordinary
|
64
|
-
# characters (not as
|
64
|
+
# characters (not as Regexp special characters):
|
65
65
|
#
|
66
66
|
# 'THX1138'.gsub('\d+', '00') # => "THX1138"
|
67
67
|
#
|
68
68
|
# **`String` `replacement`**
|
69
69
|
#
|
70
|
-
# If `replacement` is a string, that string
|
71
|
-
#
|
70
|
+
# If `replacement` is a string, that string determines the replacing string that
|
71
|
+
# is substituted for the matched text.
|
72
72
|
#
|
73
73
|
# Each of the examples above uses a simple string as the replacing string.
|
74
74
|
#
|
75
75
|
# `String` `replacement` may contain back-references to the pattern's captures:
|
76
76
|
#
|
77
|
-
# * `\n` (*n* a non-negative integer) refers to `$n`.
|
77
|
+
# * `\n` (*n* is a non-negative integer) refers to `$n`.
|
78
78
|
# * `\k<name>` refers to the named capture `name`.
|
79
79
|
#
|
80
80
|
# See Regexp for details.
|
81
81
|
#
|
82
82
|
# Note that within the string `replacement`, a character combination such as
|
83
|
-
# `$&` is treated as ordinary text,
|
84
|
-
#
|
85
|
-
# combinations:
|
83
|
+
# `$&` is treated as ordinary text, not as a special match variable. However,
|
84
|
+
# you may refer to some special match variables using these combinations:
|
86
85
|
#
|
87
86
|
# * `\&` and `\0` correspond to `$&`, which contains the complete matched
|
88
87
|
# text.
|
89
|
-
# * `\'` corresponds to `$'`, which contains string after match.
|
90
|
-
# * `\`` corresponds to `$``, which contains string before match.
|
91
|
-
# * `\+` corresponds to `$+`, which contains last capture group.
|
88
|
+
# * `\'` corresponds to `$'`, which contains the string after the match.
|
89
|
+
# * `\`` corresponds to `$``, which contains the string before the match.
|
90
|
+
# * `\+` corresponds to `$+`, which contains the last capture group.
|
92
91
|
#
|
93
92
|
# See Regexp for details.
|
94
93
|
#
|
@@ -103,16 +102,16 @@
|
|
103
102
|
# double-quoted string literal, you need to write `"..\\\\&.."`.
|
104
103
|
#
|
105
104
|
# If you want to write a non-back-reference string `\&` in `replacement`, you
|
106
|
-
# need first
|
105
|
+
# need to first escape the backslash to prevent this method from interpreting it
|
107
106
|
# as a back-reference, and then you need to escape the backslashes again to
|
108
107
|
# prevent a string literal from consuming them: `"..\\\\\\\\&.."`.
|
109
108
|
#
|
110
|
-
# You may want to use the block form to avoid
|
109
|
+
# You may want to use the block form to avoid excessive backslashes.
|
111
110
|
#
|
112
111
|
# **\Hash `replacement`**
|
113
112
|
#
|
114
|
-
# If argument `replacement` is a hash, and `pattern` matches one of its
|
115
|
-
# the replacing string is the value for that key:
|
113
|
+
# If the argument `replacement` is a hash, and `pattern` matches one of its
|
114
|
+
# keys, the replacing string is the value for that key:
|
116
115
|
#
|
117
116
|
# h = {'foo' => 'bar', 'baz' => 'bat'}
|
118
117
|
# 'food'.sub('foo', h) # => "bard"
|
@@ -127,15 +126,15 @@
|
|
127
126
|
# In the block form, the current match string is passed to the block; the
|
128
127
|
# block's return value becomes the replacing string:
|
129
128
|
#
|
130
|
-
#
|
131
|
-
# '1234'.gsub(/\d/) {|match| s.succ! } # => "ABCD"
|
129
|
+
# s = '@'
|
130
|
+
# '1234'.gsub(/\d/) { |match| s.succ! } # => "ABCD"
|
132
131
|
#
|
133
132
|
# Special match variables such as `$1`, `$2`, `$``, `$&`, and `$'` are set
|
134
133
|
# appropriately.
|
135
134
|
#
|
136
135
|
# ## Whitespace in Strings
|
137
136
|
#
|
138
|
-
# In class `String`, *whitespace* is defined as a contiguous sequence of
|
137
|
+
# In the class `String`, *whitespace* is defined as a contiguous sequence of
|
139
138
|
# characters consisting of any mixture of the following:
|
140
139
|
#
|
141
140
|
# * NL (null): `"\x00"`, `"\u0000"`.
|
@@ -146,50 +145,51 @@
|
|
146
145
|
# * CR (carriage return): `"\x0d"`, `"\r"`.
|
147
146
|
# * SP (space): `"\x20"`, `" "`.
|
148
147
|
#
|
149
|
-
# Whitespace is relevant for
|
148
|
+
# Whitespace is relevant for the following methods:
|
150
149
|
#
|
151
|
-
# * #lstrip, #lstrip!:
|
152
|
-
# * #rstrip, #rstrip!:
|
153
|
-
# * #strip, #strip!:
|
150
|
+
# * #lstrip, #lstrip!: Strip leading whitespace.
|
151
|
+
# * #rstrip, #rstrip!: Strip trailing whitespace.
|
152
|
+
# * #strip, #strip!: Strip leading and trailing whitespace.
|
154
153
|
#
|
155
154
|
# ## `String` Slices
|
156
155
|
#
|
157
|
-
# A *slice* of a string is a substring
|
156
|
+
# A *slice* of a string is a substring selected by certain criteria.
|
158
157
|
#
|
159
|
-
# These instance methods
|
158
|
+
# These instance methods utilize slicing:
|
160
159
|
#
|
161
|
-
# * String#[] (aliased as String#slice):
|
162
|
-
# * String#[]=:
|
163
|
-
# * String#slice!:
|
160
|
+
# * String#[] (aliased as String#slice): Returns a slice copied from `self`.
|
161
|
+
# * String#[]=: Mutates `self` with the slice replaced.
|
162
|
+
# * String#slice!: Mutates `self` with the slice removed and returns the
|
163
|
+
# removed slice.
|
164
164
|
#
|
165
165
|
# Each of the above methods takes arguments that determine the slice to be
|
166
166
|
# copied or replaced.
|
167
167
|
#
|
168
|
-
# The arguments have several forms. For string `string`,
|
168
|
+
# The arguments have several forms. For a string `string`, the forms are:
|
169
169
|
#
|
170
|
-
# * `string[index]
|
171
|
-
# * `string[start, length]
|
172
|
-
# * `string[range]
|
173
|
-
# * `string[regexp, capture = 0]
|
174
|
-
# * `string[substring]
|
170
|
+
# * `string[index]`
|
171
|
+
# * `string[start, length]`
|
172
|
+
# * `string[range]`
|
173
|
+
# * `string[regexp, capture = 0]`
|
174
|
+
# * `string[substring]`
|
175
175
|
#
|
176
176
|
# **`string[index]`**
|
177
177
|
#
|
178
|
-
# When non-negative integer argument `index` is given, the slice is the
|
178
|
+
# When a non-negative integer argument `index` is given, the slice is the
|
179
179
|
# 1-character substring found in `self` at character offset `index`:
|
180
180
|
#
|
181
|
-
# 'bar'[0]
|
182
|
-
# 'bar'[2]
|
183
|
-
# 'bar'[20]
|
184
|
-
# 'тест'[2]
|
185
|
-
# 'こんにちは'[4]
|
181
|
+
# 'bar'[0] # => "b"
|
182
|
+
# 'bar'[2] # => "r"
|
183
|
+
# 'bar'[20] # => nil
|
184
|
+
# 'тест'[2] # => "с"
|
185
|
+
# 'こんにちは'[4] # => "は"
|
186
186
|
#
|
187
|
-
# When negative integer `index` is given, the slice begins at the offset given
|
187
|
+
# When a negative integer `index` is given, the slice begins at the offset given
|
188
188
|
# by counting backward from the end of `self`:
|
189
189
|
#
|
190
|
-
# 'bar'[-3]
|
191
|
-
# 'bar'[-1]
|
192
|
-
# 'bar'[-20]
|
190
|
+
# 'bar'[-3] # => "b"
|
191
|
+
# 'bar'[-1] # => "r"
|
192
|
+
# 'bar'[-20] # => nil
|
193
193
|
#
|
194
194
|
# **`string[start, length]`**
|
195
195
|
#
|
@@ -197,92 +197,92 @@
|
|
197
197
|
# begins at character offset `start`, if it exists, and continues for `length`
|
198
198
|
# characters, if available:
|
199
199
|
#
|
200
|
-
# 'foo'[0, 2]
|
201
|
-
# 'тест'[1, 2]
|
202
|
-
# 'こんにちは'[2, 2]
|
200
|
+
# 'foo'[0, 2] # => "fo"
|
201
|
+
# 'тест'[1, 2] # => "ес"
|
202
|
+
# 'こんにちは'[2, 2] # => "にち"
|
203
203
|
# # Zero length.
|
204
|
-
# 'foo'[2, 0]
|
204
|
+
# 'foo'[2, 0] # => ""
|
205
205
|
# # Length not entirely available.
|
206
|
-
# 'foo'[1, 200]
|
206
|
+
# 'foo'[1, 200] # => "oo"
|
207
207
|
# # Start out of range.
|
208
208
|
# 'foo'[4, 2] # => nil
|
209
209
|
#
|
210
|
-
# Special case: if `start`
|
211
|
-
#
|
210
|
+
# Special case: if `start` equals the length of `self`, the slice is a new empty
|
211
|
+
# string:
|
212
212
|
#
|
213
|
-
# 'foo'[3, 2]
|
214
|
-
# 'foo'[3, 200]
|
213
|
+
# 'foo'[3, 2] # => ""
|
214
|
+
# 'foo'[3, 200] # => ""
|
215
215
|
#
|
216
|
-
# When negative `start` and non-negative `length` are given, the slice
|
217
|
-
#
|
218
|
-
#
|
216
|
+
# When a negative `start` and non-negative `length` are given, the slice begins
|
217
|
+
# by counting backward from the end of `self`, and continues for `length`
|
218
|
+
# characters, if available:
|
219
219
|
#
|
220
|
-
# 'foo'[-2, 2]
|
221
|
-
# 'foo'[-2, 200]
|
220
|
+
# 'foo'[-2, 2] # => "oo"
|
221
|
+
# 'foo'[-2, 200] # => "oo"
|
222
222
|
# # Start out of range.
|
223
223
|
# 'foo'[-4, 2] # => nil
|
224
224
|
#
|
225
|
-
# When negative `length` is given, there is no slice:
|
225
|
+
# When a negative `length` is given, there is no slice:
|
226
226
|
#
|
227
|
-
# 'foo'[1, -1]
|
228
|
-
# 'foo'[-2, -1]
|
227
|
+
# 'foo'[1, -1] # => nil
|
228
|
+
# 'foo'[-2, -1] # => nil
|
229
229
|
#
|
230
230
|
# **`string[range]`**
|
231
231
|
#
|
232
|
-
# When Range argument `range` is given, creates a substring of `string`
|
233
|
-
# the indices in `range`. The slice is then determined as above:
|
232
|
+
# When a Range argument `range` is given, it creates a substring of `string`
|
233
|
+
# using the indices in `range`. The slice is then determined as above:
|
234
234
|
#
|
235
|
-
# 'foo'[0..1]
|
236
|
-
# 'foo'[0, 2]
|
235
|
+
# 'foo'[0..1] # => "fo"
|
236
|
+
# 'foo'[0, 2] # => "fo"
|
237
237
|
#
|
238
|
-
# 'foo'[2...2]
|
239
|
-
# 'foo'[2, 0]
|
238
|
+
# 'foo'[2...2] # => ""
|
239
|
+
# 'foo'[2, 0] # => ""
|
240
240
|
#
|
241
|
-
# 'foo'[1..200]
|
242
|
-
# 'foo'[1, 200]
|
241
|
+
# 'foo'[1..200] # => "oo"
|
242
|
+
# 'foo'[1, 200] # => "oo"
|
243
243
|
#
|
244
|
-
# 'foo'[4..5]
|
245
|
-
# 'foo'[4, 2]
|
244
|
+
# 'foo'[4..5] # => nil
|
245
|
+
# 'foo'[4, 2] # => nil
|
246
246
|
#
|
247
|
-
# 'foo'[-4..-3]
|
248
|
-
# 'foo'[-4, 2]
|
247
|
+
# 'foo'[-4..-3] # => nil
|
248
|
+
# 'foo'[-4, 2] # => nil
|
249
249
|
#
|
250
|
-
# 'foo'[3..4]
|
251
|
-
# 'foo'[3, 2]
|
250
|
+
# 'foo'[3..4] # => ""
|
251
|
+
# 'foo'[3, 2] # => ""
|
252
252
|
#
|
253
|
-
# 'foo'[-2..-1]
|
254
|
-
# 'foo'[-2, 2]
|
253
|
+
# 'foo'[-2..-1] # => "oo"
|
254
|
+
# 'foo'[-2, 2] # => "oo"
|
255
255
|
#
|
256
|
-
# 'foo'[-2..197]
|
257
|
-
# 'foo'[-2, 200]
|
256
|
+
# 'foo'[-2..197] # => "oo"
|
257
|
+
# 'foo'[-2, 200] # => "oo"
|
258
258
|
#
|
259
259
|
# **`string[regexp, capture = 0]`**
|
260
260
|
#
|
261
261
|
# When the Regexp argument `regexp` is given, and the `capture` argument is `0`,
|
262
262
|
# the slice is the first matching substring found in `self`:
|
263
263
|
#
|
264
|
-
# 'foo'[/o/]
|
265
|
-
# 'foo'[/x/]
|
264
|
+
# 'foo'[/o/] # => "o"
|
265
|
+
# 'foo'[/x/] # => nil
|
266
266
|
# s = 'hello there'
|
267
|
-
# s[/[aeiou](.)\1/]
|
268
|
-
# s[/[aeiou](.)\1/, 0]
|
267
|
+
# s[/[aeiou](.)\1/] # => "ell"
|
268
|
+
# s[/[aeiou](.)\1/, 0] # => "ell"
|
269
269
|
#
|
270
|
-
# If argument `capture` is
|
271
|
-
# group index (integer) or a capture group name (
|
272
|
-
# the specified capture (see Regexp@Groups
|
270
|
+
# If the argument `capture` is provided and not `0`, it should be either a
|
271
|
+
# capture group index (integer) or a capture group name (String or Symbol); the
|
272
|
+
# slice is the specified capture (see Regexp@Groups and Captures):
|
273
273
|
#
|
274
274
|
# s = 'hello there'
|
275
275
|
# s[/[aeiou](.)\1/, 1] # => "l"
|
276
276
|
# s[/(?<vowel>[aeiou])(?<non_vowel>[^aeiou])/, "non_vowel"] # => "l"
|
277
|
-
# s[/(?<vowel>[aeiou])(?<non_vowel>[^aeiou])/, :vowel]
|
277
|
+
# s[/(?<vowel>[aeiou])(?<non_vowel>[^aeiou])/, :vowel] # => "e"
|
278
278
|
#
|
279
279
|
# If an invalid capture group index is given, there is no slice. If an invalid
|
280
280
|
# capture group name is given, `IndexError` is raised.
|
281
281
|
#
|
282
282
|
# **`string[substring]`**
|
283
283
|
#
|
284
|
-
# When the single `String` argument `substring` is given, returns the
|
285
|
-
# from `self` if found, otherwise `nil`:
|
284
|
+
# When the single `String` argument `substring` is given, it returns the
|
285
|
+
# substring from `self` if found, otherwise `nil`:
|
286
286
|
#
|
287
287
|
# 'foo'['oo'] # => "oo"
|
288
288
|
# 'foo'['xx'] # => nil
|
@@ -291,8 +291,8 @@
|
|
291
291
|
#
|
292
292
|
# First, what's elsewhere. Class `String`:
|
293
293
|
#
|
294
|
-
# * Inherits from [class
|
295
|
-
# * Includes [module
|
294
|
+
# * Inherits from the [Object class](rdoc-ref:Object@What-27s+Here).
|
295
|
+
# * Includes the [Comparable module](rdoc-ref:Comparable@What-27s+Here).
|
296
296
|
#
|
297
297
|
# Here, class `String` provides methods that are useful for:
|
298
298
|
#
|
@@ -315,11 +315,11 @@
|
|
315
315
|
#
|
316
316
|
# ### Methods for a Frozen/Unfrozen String
|
317
317
|
#
|
318
|
-
# * #+@: Returns a string that is not frozen: `self
|
319
|
-
#
|
320
|
-
# * #-@ (aliased as #dedup): Returns a string that is frozen: `self
|
318
|
+
# * #+@: Returns a string that is not frozen: `self` if not frozen; `self.dup`
|
319
|
+
# otherwise.
|
320
|
+
# * #-@ (aliased as #dedup): Returns a string that is frozen: `self` if
|
321
321
|
# already frozen; `self.freeze` otherwise.
|
322
|
-
# * #freeze: Freezes `self
|
322
|
+
# * #freeze: Freezes `self` if not already frozen; returns `self`.
|
323
323
|
#
|
324
324
|
# ### Methods for Querying
|
325
325
|
#
|
@@ -384,7 +384,8 @@
|
|
384
384
|
#
|
385
385
|
# *Insertion*
|
386
386
|
#
|
387
|
-
# * #insert: Returns `self` with a given string inserted at a
|
387
|
+
# * #insert: Returns `self` with a given string inserted at a specified
|
388
|
+
# offset.
|
388
389
|
# * #<<: Returns `self` concatenated with a given string or integer.
|
389
390
|
# * #append_as_bytes: Returns `self` concatenated with strings without
|
390
391
|
# performing any encoding validation or conversion.
|
@@ -421,8 +422,8 @@
|
|
421
422
|
#
|
422
423
|
# *Encoding*
|
423
424
|
#
|
424
|
-
# * #encode!: Returns `self` with all characters transcoded from one
|
425
|
-
#
|
425
|
+
# * #encode!: Returns `self` with all characters transcoded from one encoding
|
426
|
+
# to another.
|
426
427
|
# * #unicode_normalize!: Unicode-normalizes `self`; returns `self`.
|
427
428
|
# * #scrub!: Replaces each invalid byte with a given character; returns
|
428
429
|
# `self`.
|
@@ -442,8 +443,8 @@
|
|
442
443
|
# `nil` otherwise.
|
443
444
|
# * #strip!: Removes leading and trailing whitespace; returns `self` if any
|
444
445
|
# changes, `nil` otherwise.
|
445
|
-
# * #chomp!: Removes trailing record separator, if found; returns `self`
|
446
|
-
# any changes, `nil` otherwise.
|
446
|
+
# * #chomp!: Removes the trailing record separator, if found; returns `self`
|
447
|
+
# if any changes, `nil` otherwise.
|
447
448
|
# * #chop!: Removes trailing newline characters if found; otherwise removes
|
448
449
|
# the last character; returns `self` if any changes, `nil` otherwise.
|
449
450
|
#
|
@@ -454,9 +455,9 @@
|
|
454
455
|
#
|
455
456
|
# *Extension*
|
456
457
|
#
|
457
|
-
# * #*: Returns the concatenation of multiple copies of `self
|
458
|
+
# * #*: Returns the concatenation of multiple copies of `self`.
|
458
459
|
# * #+: Returns the concatenation of `self` and a given other string.
|
459
|
-
# * #center: Returns a copy of `self` centered between pad
|
460
|
+
# * #center: Returns a copy of `self` centered between pad substrings.
|
460
461
|
# * #concat: Returns the concatenation of `self` with given other strings.
|
461
462
|
# * #prepend: Returns the concatenation of a given other string with `self`.
|
462
463
|
# * #ljust: Returns a copy of `self` of a given length, right-padded with a
|
@@ -472,28 +473,28 @@
|
|
472
473
|
# * #unicode_normalize: Returns a copy of `self` with each character
|
473
474
|
# Unicode-normalized.
|
474
475
|
# * #encode: Returns a copy of `self` with all characters transcoded from one
|
475
|
-
#
|
476
|
+
# encoding to another.
|
476
477
|
#
|
477
478
|
# *Substitution*
|
478
479
|
#
|
479
480
|
# * #dump: Returns a copy of `self` with all non-printing characters replaced
|
480
481
|
# by xHH notation and all special characters escaped.
|
481
|
-
# * #undump: Returns a copy of `self` with all `\xNN`
|
482
|
-
# `\uNNNN`
|
482
|
+
# * #undump: Returns a copy of `self` with all `\xNN` notations replaced by
|
483
|
+
# `\uNNNN` notations and all escaped characters unescaped.
|
483
484
|
# * #sub: Returns a copy of `self` with the first substring matching a given
|
484
|
-
# pattern replaced with a given replacement string
|
485
|
+
# pattern replaced with a given replacement string.
|
485
486
|
# * #gsub: Returns a copy of `self` with each substring that matches a given
|
486
487
|
# pattern replaced with a given replacement string.
|
487
488
|
# * #succ (aliased as #next): Returns the string that is the successor to
|
488
489
|
# `self`.
|
489
490
|
# * #reverse: Returns a copy of `self` with its characters in reverse order.
|
490
491
|
# * #tr: Returns a copy of `self` with specified characters replaced with
|
491
|
-
# specified
|
492
|
+
# specified replacement characters.
|
492
493
|
# * #tr_s: Returns a copy of `self` with specified characters replaced with
|
493
494
|
# specified replacement characters, removing duplicates from the substrings
|
494
495
|
# that were modified.
|
495
496
|
# * #%: Returns the string resulting from formatting a given object into
|
496
|
-
# `self
|
497
|
+
# `self`.
|
497
498
|
#
|
498
499
|
# *Casing*
|
499
500
|
#
|
@@ -506,7 +507,7 @@
|
|
506
507
|
#
|
507
508
|
# *Deletion*
|
508
509
|
#
|
509
|
-
# * #delete: Returns a copy of `self` with characters removed
|
510
|
+
# * #delete: Returns a copy of `self` with characters removed.
|
510
511
|
# * #delete_prefix: Returns a copy of `self` with a given prefix removed.
|
511
512
|
# * #delete_suffix: Returns a copy of `self` with a given suffix removed.
|
512
513
|
# * #lstrip: Returns a copy of `self` with leading whitespace removed.
|
@@ -520,7 +521,7 @@
|
|
520
521
|
# * #squeeze: Returns a copy of `self` with contiguous duplicate characters
|
521
522
|
# removed.
|
522
523
|
# * #[] (aliased as #slice): Returns a substring determined by a given index,
|
523
|
-
# start/length,
|
524
|
+
# start/length, range, regexp, or string.
|
524
525
|
# * #byteslice: Returns a substring determined by a given index, start/length,
|
525
526
|
# or range.
|
526
527
|
# * #chr: Returns the first character.
|
@@ -539,7 +540,7 @@
|
|
539
540
|
# * #bytes: Returns an array of the bytes in `self`.
|
540
541
|
# * #chars: Returns an array of the characters in `self`.
|
541
542
|
# * #codepoints: Returns an array of the integer ordinals in `self`.
|
542
|
-
# * #getbyte: Returns
|
543
|
+
# * #getbyte: Returns the integer byte at the given index in `self`.
|
543
544
|
# * #grapheme_clusters: Returns an array of the grapheme clusters in `self`.
|
544
545
|
#
|
545
546
|
# *Splitting*
|
@@ -547,17 +548,17 @@
|
|
547
548
|
# * #lines: Returns an array of the lines in `self`, as determined by a given
|
548
549
|
# record separator.
|
549
550
|
# * #partition: Returns a 3-element array determined by the first substring
|
550
|
-
# that matches a given substring or regexp
|
551
|
+
# that matches a given substring or regexp.
|
551
552
|
# * #rpartition: Returns a 3-element array determined by the last substring
|
552
|
-
# that matches a given substring or regexp
|
553
|
+
# that matches a given substring or regexp.
|
553
554
|
# * #split: Returns an array of substrings determined by a given delimiter --
|
554
|
-
# regexp or string -- or, if a block given, passes those substrings to
|
555
|
-
# block.
|
555
|
+
# regexp or string -- or, if a block is given, passes those substrings to
|
556
|
+
# the block.
|
556
557
|
#
|
557
558
|
# *Matching*
|
558
559
|
#
|
559
560
|
# * #scan: Returns an array of substrings matching a given regexp or string,
|
560
|
-
# or, if a block given, passes each matching substring to the
|
561
|
+
# or, if a block is given, passes each matching substring to the block.
|
561
562
|
# * #unpack: Returns an array of substrings extracted from `self` according to
|
562
563
|
# a given format.
|
563
564
|
# * #unpack1: Returns the first substring extracted from `self` according to a
|
@@ -577,8 +578,8 @@
|
|
577
578
|
#
|
578
579
|
# *Strings and Symbols*
|
579
580
|
#
|
580
|
-
# * #inspect: Returns copy of `self`, enclosed in double
|
581
|
-
# characters escaped.
|
581
|
+
# * #inspect: Returns a copy of `self`, enclosed in double quotes, with
|
582
|
+
# special characters escaped.
|
582
583
|
# * #intern (aliased as #to_sym): Returns the symbol corresponding to `self`.
|
583
584
|
#
|
584
585
|
# ### Methods for Iterating
|
@@ -734,7 +735,8 @@ class String
|
|
734
735
|
# rdoc-file=string.c
|
735
736
|
# - +string -> new_string or self
|
736
737
|
# -->
|
737
|
-
# Returns `self` if `self` is not frozen
|
738
|
+
# Returns `self` if `self` is not frozen and can be mutated without warning
|
739
|
+
# issuance.
|
738
740
|
#
|
739
741
|
# Otherwise returns `self.dup`, which is not frozen.
|
740
742
|
#
|
data/core/time.rbs
CHANGED
@@ -331,6 +331,10 @@
|
|
331
331
|
# keyword argument `in:`, and when Time#getlocal or Time#localtime is called
|
332
332
|
# with `tz` as the value for positional argument `zone`.
|
333
333
|
#
|
334
|
+
# The UTC offset will be calculated as the difference between the original
|
335
|
+
# time and the returned object as an `Integer`. If the object is in fixed
|
336
|
+
# offset, its `utc_offset` is also counted.
|
337
|
+
#
|
334
338
|
# Argument
|
335
339
|
# : a [Time-like object](rdoc-ref:Time@Time-Like+Objects).
|
336
340
|
#
|
@@ -1625,7 +1629,7 @@ class Time < Object
|
|
1625
1629
|
#
|
1626
1630
|
# You must require 'time' to use this method.
|
1627
1631
|
#
|
1628
|
-
def xmlschema: () -> String
|
1632
|
+
def xmlschema: (?Integer fraction_digits) -> String
|
1629
1633
|
|
1630
1634
|
# <!--
|
1631
1635
|
# rdoc-file=time.c
|