rbs 3.10.0 → 3.10.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.
data/core/set.rbs CHANGED
@@ -299,7 +299,7 @@ class Set[unchecked out A]
299
299
  # rdoc-file=set.c
300
300
  # - add(obj) -> self
301
301
  # -->
302
- # Adds the given object to the set and returns self. Use `merge` to add many
302
+ # Adds the given object to the set and returns self. Use Set#merge to add many
303
303
  # elements at once.
304
304
  #
305
305
  # Set[1, 2].add(3) #=> Set[1, 2, 3]
@@ -309,7 +309,7 @@ class Set[unchecked out A]
309
309
  def add: (A) -> self
310
310
 
311
311
  # <!-- rdoc-file=set.c -->
312
- # Adds the given object to the set and returns self. Use `merge` to add many
312
+ # Adds the given object to the set and returns self. Use Set#merge to add many
313
313
  # elements at once.
314
314
  #
315
315
  # Set[1, 2].add(3) #=> Set[1, 2, 3]
data/core/signal.rbs CHANGED
@@ -65,26 +65,36 @@ module Signal
65
65
 
66
66
  # <!--
67
67
  # rdoc-file=signal.c
68
- # - Signal.trap( signal, command ) -> obj
69
- # - Signal.trap( signal ) {| | block } -> obj
68
+ # - Signal.trap(signal, command) -> obj
69
+ # - Signal.trap(signal) { ... } -> obj
70
70
  # -->
71
- # Specifies the handling of signals. The first parameter is a signal name (a
72
- # string such as ``SIGALRM'', ``SIGUSR1'', and so on) or a signal number. The
73
- # characters ``SIG'' may be omitted from the signal name. The command or block
74
- # specifies code to be run when the signal is raised. If the command is the
75
- # string ``IGNORE'' or ``SIG_IGN'', the signal will be ignored. If the command
76
- # is ``DEFAULT'' or ``SIG_DFL'', the Ruby's default handler will be invoked. If
77
- # the command is ``EXIT'', the script will be terminated by the signal. If the
78
- # command is ``SYSTEM_DEFAULT'', the operating system's default handler will be
79
- # invoked. Otherwise, the given command or block will be run. The special signal
80
- # name ``EXIT'' or signal number zero will be invoked just prior to program
81
- # termination. trap returns the previous handler for the given signal.
71
+ # Specifies the handling of signals. Returns the previous handler for the given
72
+ # signal.
73
+ #
74
+ # Argument `signal` is a signal name (a string or symbol such as `SIGALRM` or
75
+ # `SIGUSR1`) or an integer signal number. When `signal` is a string or symbol,
76
+ # the leading characters `SIG` may be omitted.
77
+ #
78
+ # Argument `command` or block provided specifies code to be run when the signal
79
+ # is raised.
80
+ #
81
+ # Argument `command` may also be a string or symbol with the following special
82
+ # values:
83
+ #
84
+ # * `IGNORE`, `SIG_IGN`: the signal will be ignored.
85
+ # * `DEFAULT`, `SIG_DFL`: Ruby's default handler will be invoked.
86
+ # * `EXIT`: the process will be terminated by the signal.
87
+ # * `SYSTEM_DEFAULT`: the operating system's default handler will be invoked.
88
+ #
89
+ # The special signal name `EXIT` or signal number zero will be invoked just
90
+ # prior to program termination:
82
91
  #
83
92
  # Signal.trap(0, proc { puts "Terminating: #{$$}" })
84
93
  # Signal.trap("CLD") { puts "Child died" }
85
94
  # fork && Process.wait
86
95
  #
87
- # *produces:*
96
+ # Outputs:
97
+ #
88
98
  # Terminating: 27461
89
99
  # Child died
90
100
  # Terminating: 27460
data/core/string.rbs CHANGED
@@ -1177,23 +1177,28 @@ class String
1177
1177
 
1178
1178
  # <!--
1179
1179
  # rdoc-file=string.c
1180
- # - self <=> other_string -> -1, 0, 1, or nil
1180
+ # - self <=> other -> -1, 0, 1, or nil
1181
1181
  # -->
1182
- # Compares `self` and `other_string`, returning:
1182
+ # Compares `self` and `other`, evaluating their *contents*, not their *lengths*.
1183
1183
  #
1184
- # * -1 if `other_string` is larger.
1185
- # * 0 if the two are equal.
1186
- # * 1 if `other_string` is smaller.
1187
- # * `nil` if the two are incomparable.
1184
+ # Returns:
1185
+ #
1186
+ # * `-1`, if `self` is smaller.
1187
+ # * `0`, if the two are equal.
1188
+ # * `1`, if `self` is larger.
1189
+ # * `nil`, if the two are incomparable.
1188
1190
  #
1189
1191
  # Examples:
1190
1192
  #
1191
- # 'foo' <=> 'foo' # => 0
1192
- # 'foo' <=> 'food' # => -1
1193
- # 'food' <=> 'foo' # => 1
1194
- # 'FOO' <=> 'foo' # => -1
1195
- # 'foo' <=> 'FOO' # => 1
1196
- # 'foo' <=> 1 # => nil
1193
+ # 'a' <=> 'b' # => -1
1194
+ # 'a' <=> 'ab' # => -1
1195
+ # 'a' <=> 'a' # => 0
1196
+ # 'b' <=> 'a' # => 1
1197
+ # 'ab' <=> 'a' # => 1
1198
+ # 'a' <=> :a # => nil
1199
+ #
1200
+ # Class String includes module Comparable, each of whose methods uses String#<=>
1201
+ # for comparison.
1197
1202
  #
1198
1203
  # Related: see [Comparing](rdoc-ref:String@Comparing).
1199
1204
  #
@@ -1576,9 +1581,9 @@ class String
1576
1581
  # s['ll'] = 'foo' # => "foo"
1577
1582
  # s # => "hefooo"
1578
1583
  #
1579
- # s = 'тест'
1580
- # s['ес'] = 'foo' # => "foo"
1581
- # s # => "тfooт"
1584
+ # s = 'Привет'
1585
+ # s['ив'] = 'foo' # => "foo"
1586
+ # s # => "Прfooет"
1582
1587
  #
1583
1588
  # s = 'こんにちは'
1584
1589
  # s['んにち'] = 'foo' # => "foo"
@@ -1817,8 +1822,8 @@ class String
1817
1822
  # -->
1818
1823
  # Returns an array of the bytes in `self`:
1819
1824
  #
1820
- # 'hello'.bytes # => [104, 101, 108, 108, 111]
1821
- # 'тест'.bytes # => [209, 130, 208, 181, 209, 129, 209, 130]
1825
+ # 'hello'.bytes # => [104, 101, 108, 108, 111]
1826
+ # 'Привет'.bytes # => [208, 159, 209, 128, 208, 184, 208, 178, 208, 181, 209, 130]
1822
1827
  # 'こんにちは'.bytes
1823
1828
  # # => [227, 129, 147, 227, 130, 147, 227, 129, 171, 227, 129, 161, 227, 129, 175]
1824
1829
  #
@@ -1840,9 +1845,9 @@ class String
1840
1845
  # s = 'foo'
1841
1846
  # s.bytesize # => 3
1842
1847
  # s.size # => 3
1843
- # s = 'тест'
1844
- # s.bytesize # => 8
1845
- # s.size # => 4
1848
+ # s = 'Привет'
1849
+ # s.bytesize # => 12
1850
+ # s.size # => 6
1846
1851
  # s = 'こんにちは'
1847
1852
  # s.bytesize # => 15
1848
1853
  # s.size # => 5
@@ -2108,7 +2113,7 @@ class String
2108
2113
  # 'hello'.center(20, '-|') # => "-|-|-|-hello-|-|-|-|" # Some padding repeated.
2109
2114
  # 'hello'.center(10, 'abcdefg') # => "abhelloabc" # Some padding not used.
2110
2115
  # ' hello '.center(13) # => " hello "
2111
- # 'тест'.center(10) # => " тест "
2116
+ # 'Привет'.center(10) # => " Привет "
2112
2117
  # 'こんにちは'.center(10) # => " こんにちは " # Multi-byte characters.
2113
2118
  #
2114
2119
  # If `size` is less than or equal to the size of `self`, returns an unpadded
@@ -2129,7 +2134,7 @@ class String
2129
2134
  # Returns an array of the characters in `self`:
2130
2135
  #
2131
2136
  # 'hello'.chars # => ["h", "e", "l", "l", "o"]
2132
- # 'тест'.chars # => ["т", "е", "с", "т"]
2137
+ # 'Привет'.chars # => ["П", "р", "и", "в", "е", "т"]
2133
2138
  # 'こんにちは'.chars # => ["こ", "ん", "に", "ち", "は"]
2134
2139
  # ''.chars # => []
2135
2140
  #
@@ -3927,8 +3932,8 @@ class String
3927
3932
  # `self`, not `self`.
3928
3933
  #
3929
3934
  # If `pattern` is a Regexp, performs the equivalent of `self.match(pattern)`
3930
- # (also setting [pattern-matching global
3931
- # variables](rdoc-ref:language/globals.md@Pattern+Matching)):
3935
+ # (also setting [matched-data
3936
+ # variables](rdoc-ref:language/globals.md@Matched+Data)):
3932
3937
  #
3933
3938
  # 'hello'.partition(/h/) # => ["", "h", "ello"]
3934
3939
  # 'hello'.partition(/l/) # => ["he", "l", "lo"]
@@ -3941,8 +3946,8 @@ class String
3941
3946
  #
3942
3947
  # If `pattern` is not a Regexp, converts it to a string (if it is not already
3943
3948
  # one), then performs the equivalent of `self.index(pattern)` (and does *not*
3944
- # set [pattern-matching global
3945
- # variables](rdoc-ref:language/globals.md@Pattern+Matching)):
3949
+ # set [matched-data global
3950
+ # variables](rdoc-ref:language/globals.md@Matched+Data)):
3946
3951
  #
3947
3952
  # 'hello'.partition('h') # => ["", "h", "ello"]
3948
3953
  # 'hello'.partition('l') # => ["he", "l", "lo"]
@@ -4132,8 +4137,8 @@ class String
4132
4137
  # `self`, not `self`.
4133
4138
  #
4134
4139
  # If `pattern` is a Regexp, searches for the last matching substring (also
4135
- # setting [pattern-matching global
4136
- # variables](rdoc-ref:language/globals.md@Pattern+Matching)):
4140
+ # setting [matched-data global
4141
+ # variables](rdoc-ref:language/globals.md@Matched+Data)):
4137
4142
  #
4138
4143
  # 'hello'.rpartition(/l/) # => ["hel", "l", "o"]
4139
4144
  # 'hello'.rpartition(/ll/) # => ["he", "ll", "o"]
@@ -4146,8 +4151,7 @@ class String
4146
4151
  #
4147
4152
  # If `pattern` is not a Regexp, converts it to a string (if it is not already
4148
4153
  # one), then searches for the last matching substring (and does *not* set
4149
- # [pattern-matching global
4150
- # variables](rdoc-ref:language/globals.md@Pattern+Matching)):
4154
+ # [matched-data global variables](rdoc-ref:language/globals.md@Matched+Data)):
4151
4155
  #
4152
4156
  # 'hello'.rpartition('l') # => ["hel", "l", "o"]
4153
4157
  # 'hello'.rpartition('ll') # => ["he", "ll", "o"]
data/core/symbol.rbs CHANGED
@@ -130,19 +130,25 @@ class Symbol
130
130
 
131
131
  # <!--
132
132
  # rdoc-file=string.c
133
- # - symbol <=> object -> -1, 0, +1, or nil
133
+ # - self <=> other -> -1, 0, 1, or nil
134
134
  # -->
135
- # If `object` is a symbol, returns the equivalent of `symbol.to_s <=>
136
- # object.to_s`:
135
+ # Compares `self` and `other`, using String#<=>.
137
136
  #
138
- # :bar <=> :foo # => -1
139
- # :foo <=> :foo # => 0
140
- # :foo <=> :bar # => 1
137
+ # Returns:
141
138
  #
142
- # Otherwise, returns `nil`:
139
+ # * `self.to_s <=> other.to_s`, if `other` is a symbol.
140
+ # * `nil`, otherwise.
143
141
  #
142
+ # Examples:
143
+ #
144
+ # :bar <=> :foo # => -1
145
+ # :foo <=> :foo # => 0
146
+ # :foo <=> :bar # => 1
144
147
  # :foo <=> 'bar' # => nil
145
148
  #
149
+ # Class Symbol includes module Comparable, each of whose methods uses Symbol#<=>
150
+ # for comparison.
151
+ #
146
152
  # Related: String#<=>.
147
153
  #
148
154
  def <=>: (Symbol object) -> (-1 | 0 | 1)
data/core/thread.rbs CHANGED
@@ -963,12 +963,11 @@ class Thread < Object
963
963
 
964
964
  # <!--
965
965
  # rdoc-file=thread.c
966
- # - thr.raise
967
- # - thr.raise(string)
968
- # - thr.raise(exception [, string [, array]])
966
+ # - raise(exception, message = exception.to_s, backtrace = nil, cause: $!)
967
+ # - raise(message = nil, cause: $!)
969
968
  # -->
970
969
  # Raises an exception from the given thread. The caller does not have to be
971
- # `thr`. See Kernel#raise for more information.
970
+ # `thr`. See Kernel#raise for more information on arguments.
972
971
  #
973
972
  # Thread.abort_on_exception = true
974
973
  # a = Thread.new { sleep(200) }
@@ -184,6 +184,13 @@ module RBS
184
184
  lockfile.gems[name] = { name: name, version: "0", source: source }
185
185
  end
186
186
  return
187
+ when 'set', 'pathname'
188
+ # set and pathname is migrated to core from stdlib.
189
+ RBS.logger.info {
190
+ from = from_gem || "rbs_collection.yaml"
191
+ "`#{name}` is a part of the Ruby core library. The dependency to the library can be safely deleted from #{from}."
192
+ }
193
+ return
187
194
  when *ALUMNI_STDLIBS.keys
188
195
  version = ALUMNI_STDLIBS.fetch(name)
189
196
  if from_gem
@@ -50,12 +50,6 @@ module RBS
50
50
  when path
51
51
  dirs << path
52
52
  when library
53
- case library
54
- when 'pathname'
55
- RBS.logger.warn "`#{library}` has been moved to core library, so it is always loaded. Remove explicit loading `#{library}`"
56
- return
57
- end
58
-
59
53
  if libs.add?(Library.new(name: library, version: version)) && resolve_dependencies
60
54
  resolve_dependencies(library: library, version: version)
61
55
  end
@@ -107,7 +107,9 @@ module RBS
107
107
  each_member(owner).any? do |m|
108
108
  case m
109
109
  when AST::Members::InstanceVariable
110
- m.name == name
110
+ m.name == name && kind == :instance
111
+ when AST::Members::ClassInstanceVariable
112
+ m.name == name && kind == :singleton
111
113
  when AST::Members::Attribute
112
114
  ivar_name = m.ivar_name == false ? nil : m.ivar_name || :"@#{m.name}"
113
115
  ivar_name == name && m.kind == kind
data/lib/rbs/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RBS
4
- VERSION = "3.10.0"
4
+ VERSION = "3.10.1"
5
5
  end
@@ -1,5 +1,15 @@
1
1
  # <!-- rdoc-file=lib/cgi/escape.rb -->
2
- # :stopdoc
2
+ # Since Ruby 4.0, CGI is a small holder for various escaping methods, included
3
+ # from CGI::Escape
4
+ #
5
+ # require 'cgi/escape'
6
+ #
7
+ # CGI.escape("Ruby programming language")
8
+ # #=> "Ruby+programming+language"
9
+ # CGI.escapeURIComponent("Ruby programming language")
10
+ # #=> "Ruby%20programming%20language"
11
+ #
12
+ # See CGI::Escape module for methods list and their description.
3
13
  #
4
14
  class CGI
5
15
  include CGI::Util
@@ -1,5 +1,15 @@
1
1
  # <!-- rdoc-file=lib/cgi/escape.rb -->
2
- # :stopdoc
2
+ # Since Ruby 4.0, CGI is a small holder for various escaping methods, included
3
+ # from CGI::Escape
4
+ #
5
+ # require 'cgi/escape'
6
+ #
7
+ # CGI.escape("Ruby programming language")
8
+ # #=> "Ruby+programming+language"
9
+ # CGI.escapeURIComponent("Ruby programming language")
10
+ # #=> "Ruby%20programming%20language"
11
+ #
12
+ # See CGI::Escape module for methods list and their description.
3
13
  #
4
14
  class CGI
5
15
  include Escape
@@ -7,7 +17,7 @@ class CGI
7
17
  extend Escape
8
18
 
9
19
  # <!-- rdoc-file=lib/cgi/escape.rb -->
10
- # Escape/unescape for CGI, HTML, URI.
20
+ # Web-related escape/unescape functionality.
11
21
  #
12
22
  module Escape
13
23
  # <!--
@@ -15,7 +25,7 @@ class CGI
15
25
  # - escape(string)
16
26
  # -->
17
27
  # URL-encode a string into application/x-www-form-urlencoded. Space characters
18
- # (+" "+) are encoded with plus signs (+"+"+)
28
+ # (`" "`) are encoded with plus signs (`"+"`)
19
29
  # url_encoded_string = CGI.escape("'Stop!' said Fred")
20
30
  # # => "%27Stop%21%27+said+Fred"
21
31
  #
@@ -45,7 +55,7 @@ class CGI
45
55
  # rdoc-file=lib/cgi/escape.rb
46
56
  # - escapeHTML(string)
47
57
  # -->
48
- # Escape special characters in HTML, namely '&"<>
58
+ # Escape special characters in HTML, namely `'&\"<>`
49
59
  # CGI.escapeHTML('Usage: foo "bar" <baz>')
50
60
  # # => "Usage: foo &quot;bar&quot; &lt;baz&gt;"
51
61
  #
@@ -55,20 +65,24 @@ class CGI
55
65
  # rdoc-file=lib/cgi/escape.rb
56
66
  # - escapeURIComponent(string)
57
67
  # -->
58
- # URL-encode a string following RFC 3986 Space characters (+" "+) are encoded
59
- # with (+"%20"+)
68
+ # URL-encode a string following RFC 3986 Space characters (`" "`) are encoded
69
+ # with (`"%20"`)
60
70
  # url_encoded_string = CGI.escapeURIComponent("'Stop!' said Fred")
61
71
  # # => "%27Stop%21%27%20said%20Fred"
62
72
  #
63
73
  def escapeURIComponent: (string) -> String
64
74
 
65
- # <!-- rdoc-file=lib/cgi/escape.rb -->
66
- # Synonym for CGI.escapeElement(str)
75
+ # <!--
76
+ # rdoc-file=lib/cgi/escape.rb
77
+ # - escape_element(string, *elements)
78
+ # -->
67
79
  #
68
80
  alias escape_element escapeElement
69
81
 
70
- # <!-- rdoc-file=lib/cgi/escape.rb -->
71
- # Synonym for CGI.escapeHTML(str)
82
+ # <!--
83
+ # rdoc-file=lib/cgi/escape.rb
84
+ # - escape_html(string)
85
+ # -->
72
86
  #
73
87
  alias escape_html escapeHTML
74
88
 
@@ -101,7 +115,7 @@ class CGI
101
115
  # rdoc-file=lib/cgi/escape.rb
102
116
  # - unescapeElement(string, *elements)
103
117
  # -->
104
- # Undo escaping such as that done by CGI.escapeElement()
118
+ # Undo escaping such as that done by CGI.escapeElement
105
119
  #
106
120
  # print CGI.unescapeElement(
107
121
  # CGI.escapeHTML('<BR><A HREF="url"></A>'), "A", "IMG")
@@ -133,13 +147,17 @@ class CGI
133
147
  #
134
148
  def unescapeURIComponent: (string) -> String
135
149
 
136
- # <!-- rdoc-file=lib/cgi/escape.rb -->
137
- # Synonym for CGI.unescapeElement(str)
150
+ # <!--
151
+ # rdoc-file=lib/cgi/escape.rb
152
+ # - unescape_element(string, *elements)
153
+ # -->
138
154
  #
139
155
  alias unescape_element unescapeElement
140
156
 
141
- # <!-- rdoc-file=lib/cgi/escape.rb -->
142
- # Synonym for CGI.unescapeHTML(str)
157
+ # <!--
158
+ # rdoc-file=lib/cgi/escape.rb
159
+ # - unescape_html(string)
160
+ # -->
143
161
  #
144
162
  alias unescape_html unescapeHTML
145
163
 
@@ -0,0 +1,36 @@
1
+ %a{annotate:rdoc:skip}
2
+ class Pathname
3
+ # <!--
4
+ # rdoc-file=lib/pathname.rb
5
+ # - find(ignore_error: true) { |pathname| ... }
6
+ # -->
7
+ # Iterates over the directory tree in a depth first manner, yielding a Pathname
8
+ # for each file under "this" directory.
9
+ #
10
+ # Note that you need to require 'pathname' to use this method.
11
+ #
12
+ # Returns an Enumerator if no block is given.
13
+ #
14
+ # Since it is implemented by the standard library module Find, Find.prune can be
15
+ # used to control the traversal.
16
+ #
17
+ # If `self` is `.`, yielded pathnames begin with a filename in the current
18
+ # directory, not `./`.
19
+ #
20
+ # See Find.find
21
+ #
22
+ def find: (?ignore_error: boolish) { (Pathname) -> untyped } -> nil
23
+ | (?ignore_error: boolish) -> Enumerator[Pathname, nil]
24
+
25
+ # <!--
26
+ # rdoc-file=lib/pathname.rb
27
+ # - rmtree(noop: nil, verbose: nil, secure: nil)
28
+ # -->
29
+ # Recursively deletes a directory, including all directories beneath it.
30
+ #
31
+ # Note that you need to require 'pathname' to use this method.
32
+ #
33
+ # See FileUtils.rm_rf
34
+ #
35
+ def rmtree: () -> self
36
+ end
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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
@@ -460,6 +460,7 @@ files:
460
460
  - stdlib/openssl/0/manifest.yaml
461
461
  - stdlib/openssl/0/openssl.rbs
462
462
  - stdlib/optparse/0/optparse.rbs
463
+ - stdlib/pathname/0/pathname.rbs
463
464
  - stdlib/pp/0/manifest.yaml
464
465
  - stdlib/pp/0/pp.rbs
465
466
  - stdlib/prettyprint/0/prettyprint.rbs
@@ -562,7 +563,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
562
563
  - !ruby/object:Gem::Version
563
564
  version: '0'
564
565
  requirements: []
565
- rubygems_version: 4.0.2
566
+ rubygems_version: 4.0.3
566
567
  specification_version: 4
567
568
  summary: Type signature for Ruby.
568
569
  test_files: []