rbs 3.4.0 → 3.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,62 @@
1
1
  %a{annotate:rdoc:skip}
2
2
  module ObjectSpace
3
3
  # <!-- rdoc-file=weakmap.c -->
4
- # An ObjectSpace::WeakKeyMap object holds references to any objects, but objects
5
- # uses as keys can be garbage collected.
4
+ # An ObjectSpace::WeakKeyMap is a key-value map that holds weak references to
5
+ # its keys, so they can be garbage collected when there is no more references.
6
6
  #
7
- # Objects used as values can't be garbage collected until the key is.
7
+ # Unlike ObjectSpace::WeakMap:
8
+ #
9
+ # * references to values are *strong*, so they aren't garbage collected while
10
+ # they are in the map;
11
+ # * keys are compared by value (using Object#eql?), not by identity;
12
+ # * only garbage-collectable objects can be used as keys.
13
+ #
14
+ # map = ObjectSpace::WeakKeyMap.new
15
+ # val = Time.new(2023, 12, 7)
16
+ # key = "name"
17
+ # map[key] = val
18
+ #
19
+ # # Value is fetched by equality: the instance of string "name" is
20
+ # # different here, but it is equal to the key
21
+ # map["name"] #=> 2023-12-07 00:00:00 +0200
22
+ #
23
+ # val = nil
24
+ # GC.start
25
+ # # There is no more references to `val`, yet the pair isn't
26
+ # # garbage-collected.
27
+ # map["name"] #=> 2023-12-07 00:00:00 +0200
28
+ #
29
+ # key = nil
30
+ # GC.start
31
+ # # There is no more references to `key`, key and value are
32
+ # # garbage-collected.
33
+ # map["name"] #=> nil
34
+ #
35
+ #
36
+ # (Note that GC.start is used here only for demonstrational purposes and might
37
+ # not always lead to demonstrated results.)
38
+ #
39
+ # The collection is especially useful for implementing caches of lightweight
40
+ # value objects, so that only one copy of each value representation would be
41
+ # stored in memory, but the copies that aren't used would be garbage-collected.
42
+ #
43
+ # CACHE = ObjectSpace::WeakKeyMap
44
+ #
45
+ # def make_value(**)
46
+ # val = ValueObject.new(**)
47
+ # if (existing = @cache.getkey(val))
48
+ # # if the object with this value exists, we return it
49
+ # existing
50
+ # else
51
+ # # otherwise, put it in the cache
52
+ # @cache[val] = true
53
+ # val
54
+ # end
55
+ # end
56
+ #
57
+ # This will result in `make_value` returning the same object for same set of
58
+ # attributes always, but the values that aren't needed anymore woudn't be
59
+ # sitting in the cache forever.
8
60
  #
9
61
  class WeakKeyMap[Key, Value]
10
62
  public
@@ -23,7 +75,7 @@ module ObjectSpace
23
75
  # rdoc-file=weakmap.c
24
76
  # - map[key] = value -> value
25
77
  # -->
26
- # Associates the given `value` with the given `key`; returns `value`.
78
+ # Associates the given `value` with the given `key`
27
79
  #
28
80
  # The reference to `key` is weak, so when there is no other reference to `key`
29
81
  # it may be garbage collected.
@@ -51,7 +103,8 @@ module ObjectSpace
51
103
  # If no block is given and `key` is found, deletes the entry and returns the
52
104
  # associated value:
53
105
  # m = ObjectSpace::WeakKeyMap.new
54
- # m["foo"] = 1
106
+ # key = "foo" # to hold reference to the key
107
+ # m[key] = 1
55
108
  # m.delete("foo") # => 1
56
109
  # m["foo"] # => nil
57
110
  #
@@ -60,13 +113,14 @@ module ObjectSpace
60
113
  # If a block is given and `key` is found, ignores the block, deletes the entry,
61
114
  # and returns the associated value:
62
115
  # m = ObjectSpace::WeakKeyMap.new
63
- # m["foo"] = 2
64
- # h.delete("foo") { |key| raise 'Will never happen'} # => 2
116
+ # key = "foo" # to hold reference to the key
117
+ # m[key] = 2
118
+ # m.delete("foo") { |key| raise 'Will never happen'} # => 2
65
119
  #
66
- # If a block is given and `key` is not found, calls the block and returns the
67
- # block's return value:
120
+ # If a block is given and `key` is not found, yields the `key` to the block and
121
+ # returns the block's return value:
68
122
  # m = ObjectSpace::WeakKeyMap.new
69
- # h.delete("nosuch") { |key| "Key #{key} not found" } # => "Key nosuch not found"
123
+ # m.delete("nosuch") { |key| "Key #{key} not found" } # => "Key nosuch not found"
70
124
  #
71
125
  def delete: (Key) -> Value?
72
126
  | [T] (Key) { (Key) -> T } -> (Value | T)
@@ -77,6 +131,19 @@ module ObjectSpace
77
131
  # -->
78
132
  # Returns the existing equal key if it exists, otherwise returns `nil`.
79
133
  #
134
+ # This might be useful for implementing caches, so that only one copy of some
135
+ # object would be used everywhere in the program:
136
+ #
137
+ # value = {amount: 1, currency: 'USD'}
138
+ #
139
+ # # Now if we put this object in a cache:
140
+ # cache = ObjectSpace::WeakKeyMap.new
141
+ # cache[value] = true
142
+ #
143
+ # # ...we can always extract from there and use the same object:
144
+ # copy = cache.getkey({amount: 1, currency: 'USD'})
145
+ # copy.object_id == value.object_id #=> true
146
+ #
80
147
  def getkey: (untyped) -> Key?
81
148
 
82
149
  # <!--
@@ -93,7 +160,7 @@ module ObjectSpace
93
160
 
94
161
  # <!--
95
162
  # rdoc-file=weakmap.c
96
- # - hash.key?(key) -> true or false
163
+ # - map.key?(key) -> true or false
97
164
  # -->
98
165
  # Returns `true` if `key` is a key in `self`, otherwise `false`.
99
166
  #
@@ -166,6 +166,7 @@ module ObjectSpace
166
166
  # rdoc-file=gc.rb
167
167
  # - garbage_collect(full_mark: true, immediate_mark: true, immediate_sweep: true)
168
168
  # -->
169
+ # Alias of GC.start
169
170
  #
170
171
  def self.garbage_collect: (?full_mark: bool, ?immediate_mark: bool, ?immediate_sweep: bool) -> void
171
172
 
@@ -183,6 +184,7 @@ module ObjectSpace
183
184
  # rdoc-file=gc.rb
184
185
  # - garbage_collect(full_mark: true, immediate_mark: true, immediate_sweep: true)
185
186
  # -->
187
+ # Alias of GC.start
186
188
  #
187
189
  def garbage_collect: (?full_mark: bool, ?immediate_mark: bool, ?immediate_sweep: bool) -> void
188
190
  end
data/core/process.rbs CHANGED
@@ -1788,7 +1788,6 @@ end
1788
1788
  # stat = $? # => #<Process::Status: pid 1262862 exit 99>
1789
1789
  # stat.class # => Process::Status
1790
1790
  # stat.to_i # => 25344
1791
- # stat >> 8 # => 99
1792
1791
  # stat.stopped? # => false
1793
1792
  # stat.exited? # => true
1794
1793
  # stat.exitstatus # => 99
@@ -1798,7 +1797,8 @@ class Process::Status < Object
1798
1797
  # rdoc-file=process.c
1799
1798
  # - stat & mask -> integer
1800
1799
  # -->
1801
- # This method is deprecated; use other attribute methods.
1800
+ # This method is deprecated as #to_i value is system-specific; use predicate
1801
+ # methods like #exited? or #stopped?, or getters like #exitstatus or #stopsig.
1802
1802
  #
1803
1803
  # Returns the logical AND of the value of #to_i with `mask`:
1804
1804
  #
@@ -1828,7 +1828,8 @@ class Process::Status < Object
1828
1828
  # rdoc-file=process.c
1829
1829
  # - stat >> places -> integer
1830
1830
  # -->
1831
- # This method is deprecated; use other predicate methods.
1831
+ # This method is deprecated as #to_i value is system-specific; use predicate
1832
+ # methods like #exited? or #stopped?, or getters like #exitstatus or #stopsig.
1832
1833
  #
1833
1834
  # Returns the value of #to_i, shifted `places` to the right:
1834
1835
  #
data/core/range.rbs CHANGED
@@ -871,15 +871,16 @@ class Range[out Elem] < Object
871
871
  # (1..2).overlap?(3..4) # => false
872
872
  # (1...3).overlap?(3..4) # => false
873
873
  #
874
- # This method assumes that there is no minimum value because Ruby lacks a
875
- # standard method for determining minimum values. This assumption is invalid.
876
- # For example, there is no value smaller than `-Float::INFINITY`, making
877
- # `(...-Float::INFINITY)` an empty set. Consequently, `(...-Float::INFINITY)`
878
- # has no elements in common with itself, yet
879
- # `(...-Float::INFINITY).overlap?((...-Float::INFINITY))<tt> returns true due to
880
- # this assumption. In general, if <tt>r = (...minimum); r.overlap?(r)` returns
881
- # `true`, where `minimum` is a value that no value is smaller than. Such values
882
- # include `-Float::INFINITY`, `[]`, `""`, and classes without subclasses.
874
+ # Note that the method wouldn't make any assumptions about the beginless range
875
+ # being actually empty, even if its upper bound is the minimum possible value of
876
+ # its type, so all this would return `true`:
877
+ #
878
+ # (...-Float::INFINITY).overlap?(...-Float::INFINITY) # => true
879
+ # (..."").overlap?(..."") # => true
880
+ # (...[]).overlap?(...[]) # => true
881
+ #
882
+ # Even if those ranges are effectively empty (no number can be smaller than
883
+ # `-Float::INFINITY`), they are still considered overlapping with themselves.
883
884
  #
884
885
  # Related: Range#cover?.
885
886
  #
data/core/refinement.rbs CHANGED
@@ -46,15 +46,24 @@ class Refinement < Module
46
46
  # rdoc-file=eval.c
47
47
  # - refined_class -> class
48
48
  # -->
49
+ # Deprecated; prefer #target.
50
+ #
49
51
  # Return the class refined by the receiver.
50
52
  #
51
53
  def refined_class: () -> Module
52
54
 
53
55
  # <!--
54
56
  # rdoc-file=eval.c
55
- # - target -> class
57
+ # - target -> class_or_module
56
58
  # -->
57
59
  # Return the class or module refined by the receiver.
58
60
  #
61
+ # module M
62
+ # refine String do
63
+ # end
64
+ # end
65
+ #
66
+ # M.refinements[0].target # => String
67
+ #
59
68
  def target: () -> Module
60
69
  end
data/core/string.rbs CHANGED
@@ -3163,31 +3163,30 @@ class String
3163
3163
 
3164
3164
  # <!--
3165
3165
  # rdoc-file=complex.c
3166
- # - str.to_c -> complex
3167
- # -->
3168
- # Returns a complex which denotes the string form. The parser ignores leading
3169
- # whitespaces and trailing garbage. Any digit sequences can be separated by an
3170
- # underscore. Returns zero for null or garbage string.
3171
- #
3172
- # '9'.to_c #=> (9+0i)
3173
- # '2.5'.to_c #=> (2.5+0i)
3174
- # '2.5/1'.to_c #=> ((5/2)+0i)
3175
- # '-3/2'.to_c #=> ((-3/2)+0i)
3176
- # '-i'.to_c #=> (0-1i)
3177
- # '45i'.to_c #=> (0+45i)
3178
- # '3-4i'.to_c #=> (3-4i)
3179
- # '-4e2-4e-2i'.to_c #=> (-400.0-0.04i)
3180
- # '-0.0-0.0i'.to_c #=> (-0.0-0.0i)
3181
- # '1/2+3/4i'.to_c #=> ((1/2)+(3/4)*i)
3182
- # 'ruby'.to_c #=> (0+0i)
3183
- #
3184
- # Polar form:
3185
- # include Math
3186
- # "1.0@0".to_c #=> (1+0.0i)
3187
- # "1.0@#{PI/2}".to_c #=> (0.0+1i)
3188
- # "1.0@#{PI}".to_c #=> (-1+0.0i)
3189
- #
3190
- # See Kernel.Complex.
3166
+ # - to_c -> complex
3167
+ # -->
3168
+ # Returns `self` interpreted as a Complex object; leading whitespace and
3169
+ # trailing garbage are ignored:
3170
+ #
3171
+ # '9'.to_c # => (9+0i)
3172
+ # '2.5'.to_c # => (2.5+0i)
3173
+ # '2.5/1'.to_c # => ((5/2)+0i)
3174
+ # '-3/2'.to_c # => ((-3/2)+0i)
3175
+ # '-i'.to_c # => (0-1i)
3176
+ # '45i'.to_c # => (0+45i)
3177
+ # '3-4i'.to_c # => (3-4i)
3178
+ # '-4e2-4e-2i'.to_c # => (-400.0-0.04i)
3179
+ # '-0.0-0.0i'.to_c # => (-0.0-0.0i)
3180
+ # '1/2+3/4i'.to_c # => ((1/2)+(3/4)*i)
3181
+ # '1.0@0'.to_c # => (1+0.0i)
3182
+ # "1.0@#{Math::PI/2}".to_c # => (0.0+1i)
3183
+ # "1.0@#{Math::PI}".to_c # => (-1+0.0i)
3184
+ #
3185
+ # Returns Complex zero if the string cannot be converted:
3186
+ #
3187
+ # 'ruby'.to_c # => (0+0i)
3188
+ #
3189
+ # See Kernel#Complex.
3191
3190
  #
3192
3191
  def to_c: () -> Complex
3193
3192
 
data/core/thread.rbs CHANGED
@@ -1626,8 +1626,8 @@ class Thread::Queue < Object
1626
1626
  # rdoc-file=thread_sync.c
1627
1627
  # - freeze
1628
1628
  # -->
1629
- # Raises an exception:
1630
- # Queue.new.freeze # Raises TypeError (cannot freeze #<Thread::Queue:0x...>)
1629
+ # The queue can't be frozen, so this method raises an exception:
1630
+ # Thread::Queue.new.freeze # Raises TypeError (cannot freeze #<Thread::Queue:0x...>)
1631
1631
  #
1632
1632
  def freeze: () -> bot
1633
1633
 
@@ -1711,8 +1711,8 @@ class Thread::SizedQueue < Thread::Queue
1711
1711
  # rdoc-file=thread_sync.c
1712
1712
  # - freeze
1713
1713
  # -->
1714
- # Raises an exception:
1715
- # Queue.new.freeze # Raises TypeError (cannot freeze #<Thread::Queue:0x...>)
1714
+ # The queue can't be frozen, so this method raises an exception:
1715
+ # Thread::Queue.new.freeze # Raises TypeError (cannot freeze #<Thread::Queue:0x...>)
1716
1716
  #
1717
1717
  def freeze: () -> bot
1718
1718
 
data/core/trace_point.rbs CHANGED
@@ -44,6 +44,8 @@
44
44
  # : return from a C-language routine
45
45
  # `:raise`
46
46
  # : raise an exception
47
+ # `:rescue`
48
+ # : rescue an exception
47
49
  # `:b_call`
48
50
  # : event hook at block entry
49
51
  # `:b_return`
@@ -205,7 +207,7 @@ class TracePoint < Object
205
207
  # -->
206
208
  # Return the generated binding object from event.
207
209
  #
208
- # Note that for `c_call` and `c_return` events, the method will return `nil`,
210
+ # Note that for `:c_call` and `:c_return` events, the method will return `nil`,
209
211
  # since C methods themselves do not have bindings.
210
212
  #
211
213
  def binding: () -> Binding?
@@ -416,7 +418,8 @@ class TracePoint < Object
416
418
  # rdoc-file=trace_point.rb
417
419
  # - raised_exception()
418
420
  # -->
419
- # Value from exception raised on the `:raise` event
421
+ # Value from exception raised on the `:raise` event, or rescued on the `:rescue`
422
+ # event.
420
423
  #
421
424
  def raised_exception: () -> untyped
422
425
 
@@ -424,7 +427,7 @@ class TracePoint < Object
424
427
  # rdoc-file=trace_point.rb
425
428
  # - return_value()
426
429
  # -->
427
- # Return value from `:return`, `c_return`, and `b_return` event
430
+ # Return value from `:return`, `:c_return`, and `:b_return` event
428
431
  #
429
432
  def return_value: () -> untyped
430
433
 
@@ -435,7 +438,7 @@ class TracePoint < Object
435
438
  # Return the trace object during event
436
439
  #
437
440
  # Same as the following, except it returns the correct object (the method
438
- # receiver) for `c_call` and `c_return` events:
441
+ # receiver) for `:c_call` and `:c_return` events:
439
442
  #
440
443
  # trace.binding.eval('self')
441
444
  #
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.4.0"
4
+ VERSION = "3.4.1"
5
5
  end
@@ -1711,61 +1711,60 @@ class Complex
1711
1711
 
1712
1712
  # <!--
1713
1713
  # rdoc-file=complex.c
1714
- # - cmp / numeric -> complex
1715
- # - cmp.quo(numeric) -> complex
1714
+ # - complex / numeric -> new_complex
1716
1715
  # -->
1717
- # Performs division.
1716
+ # Returns the quotient of `self` and `numeric`:
1718
1717
  #
1719
- # Complex(2, 3) / Complex(2, 3) #=> ((1/1)+(0/1)*i)
1720
- # Complex(900) / Complex(1) #=> ((900/1)+(0/1)*i)
1721
- # Complex(-2, 9) / Complex(-9, 2) #=> ((36/85)-(77/85)*i)
1722
- # Complex(9, 8) / 4 #=> ((9/4)+(2/1)*i)
1723
- # Complex(20, 9) / 9.8 #=> (2.0408163265306123+0.9183673469387754i)
1718
+ # Complex(2, 3) / Complex(2, 3) # => ((1/1)+(0/1)*i)
1719
+ # Complex(900) / Complex(1) # => ((900/1)+(0/1)*i)
1720
+ # Complex(-2, 9) / Complex(-9, 2) # => ((36/85)-(77/85)*i)
1721
+ # Complex(9, 8) / 4 # => ((9/4)+(2/1)*i)
1722
+ # Complex(20, 9) / 9.8 # => (2.0408163265306123+0.9183673469387754i)
1724
1723
  #
1725
1724
  def /: (BigDecimal) -> Complex
1726
1725
  | ...
1727
1726
 
1728
1727
  # <!--
1729
1728
  # rdoc-file=complex.c
1730
- # - cmp * numeric -> complex
1729
+ # - complex * numeric -> new_complex
1731
1730
  # -->
1732
- # Performs multiplication.
1731
+ # Returns the product of `self` and `numeric`:
1733
1732
  #
1734
- # Complex(2, 3) * Complex(2, 3) #=> (-5+12i)
1735
- # Complex(900) * Complex(1) #=> (900+0i)
1736
- # Complex(-2, 9) * Complex(-9, 2) #=> (0-85i)
1737
- # Complex(9, 8) * 4 #=> (36+32i)
1738
- # Complex(20, 9) * 9.8 #=> (196.0+88.2i)
1733
+ # Complex(2, 3) * Complex(2, 3) # => (-5+12i)
1734
+ # Complex(900) * Complex(1) # => (900+0i)
1735
+ # Complex(-2, 9) * Complex(-9, 2) # => (0-85i)
1736
+ # Complex(9, 8) * 4 # => (36+32i)
1737
+ # Complex(20, 9) * 9.8 # => (196.0+88.2i)
1739
1738
  #
1740
1739
  def *: (BigDecimal) -> Complex
1741
1740
  | ...
1742
1741
 
1743
1742
  # <!--
1744
1743
  # rdoc-file=complex.c
1745
- # - cmp + numeric -> complex
1744
+ # - complex + numeric -> new_complex
1746
1745
  # -->
1747
- # Performs addition.
1746
+ # Returns the sum of `self` and `numeric`:
1748
1747
  #
1749
- # Complex(2, 3) + Complex(2, 3) #=> (4+6i)
1750
- # Complex(900) + Complex(1) #=> (901+0i)
1751
- # Complex(-2, 9) + Complex(-9, 2) #=> (-11+11i)
1752
- # Complex(9, 8) + 4 #=> (13+8i)
1753
- # Complex(20, 9) + 9.8 #=> (29.8+9i)
1748
+ # Complex(2, 3) + Complex(2, 3) # => (4+6i)
1749
+ # Complex(900) + Complex(1) # => (901+0i)
1750
+ # Complex(-2, 9) + Complex(-9, 2) # => (-11+11i)
1751
+ # Complex(9, 8) + 4 # => (13+8i)
1752
+ # Complex(20, 9) + 9.8 # => (29.8+9i)
1754
1753
  #
1755
1754
  def +: (BigDecimal) -> Complex
1756
1755
  | ...
1757
1756
 
1758
1757
  # <!--
1759
1758
  # rdoc-file=complex.c
1760
- # - cmp - numeric -> complex
1759
+ # - complex - numeric -> new_complex
1761
1760
  # -->
1762
- # Performs subtraction.
1761
+ # Returns the difference of `self` and `numeric`:
1763
1762
  #
1764
- # Complex(2, 3) - Complex(2, 3) #=> (0+0i)
1765
- # Complex(900) - Complex(1) #=> (899+0i)
1766
- # Complex(-2, 9) - Complex(-9, 2) #=> (7+7i)
1767
- # Complex(9, 8) - 4 #=> (5+8i)
1768
- # Complex(20, 9) - 9.8 #=> (10.2+9i)
1763
+ # Complex(2, 3) - Complex(2, 3) # => (0+0i)
1764
+ # Complex(900) - Complex(1) # => (899+0i)
1765
+ # Complex(-2, 9) - Complex(-9, 2) # => (7+7i)
1766
+ # Complex(9, 8) - 4 # => (5+8i)
1767
+ # Complex(20, 9) - 9.8 # => (10.2+9i)
1769
1768
  #
1770
1769
  def -: (BigDecimal) -> Complex
1771
1770
  | ...
data/stdlib/pty/0/pty.rbs CHANGED
@@ -74,13 +74,7 @@ module PTY
74
74
  #
75
75
  def self.check: (Integer pid, ?boolish raise) -> Process::Status?
76
76
 
77
- # <!--
78
- # rdoc-file=ext/pty/pty.c
79
- # - PTY.spawn([env,] command_line) { |r, w, pid| ... }
80
- # - PTY.spawn([env,] command_line) => [r, w, pid]
81
- # - PTY.spawn([env,] command, arguments, ...) { |r, w, pid| ... }
82
- # - PTY.spawn([env,] command, arguments, ...) => [r, w, pid]
83
- # -->
77
+ # <!-- rdoc-file=ext/pty/pty.c -->
84
78
  # Spawns the specified command on a newly allocated pty. You can also use the
85
79
  # alias ::getpty.
86
80
  #
@@ -1,3 +1,7 @@
1
+ # <!-- rdoc-file=ext/socket/raddrinfo.c -->
2
+ # The Addrinfo class maps `struct addrinfo` to ruby. This structure identifies
3
+ # an Internet host and a service.
4
+ #
1
5
  class Addrinfo
2
6
  # <!--
3
7
  # rdoc-file=ext/socket/lib/socket.rb
@@ -293,8 +293,10 @@ class BasicSocket < IO
293
293
  # is set for the underlying file descriptor. *flags* is zero or more of the
294
294
  # `MSG_` options. The result, *mesg*, is the data received.
295
295
  #
296
- # When recvfrom(2) returns 0, Socket#recv_nonblock returns an empty string as
297
- # data. The meaning depends on the socket: EOF on TCP, empty packet on UDP, etc.
296
+ # When recvfrom(2) returns 0, Socket#recv_nonblock returns nil. In most cases it
297
+ # means the connection was closed, but for UDP connections it may mean an empty
298
+ # packet was received, as the underlying API makes it impossible to distinguish
299
+ # these two cases.
298
300
  #
299
301
  # ### Parameters
300
302
  # * `maxlen` - the number of bytes to receive from the socket
@@ -1289,9 +1289,10 @@ class Socket < BasicSocket
1289
1289
  # received. The second element, *sender_addrinfo*, contains protocol-specific
1290
1290
  # address information of the sender.
1291
1291
  #
1292
- # When recvfrom(2) returns 0, Socket#recvfrom_nonblock returns an empty string
1293
- # as data. The meaning depends on the socket: EOF on TCP, empty packet on UDP,
1294
- # etc.
1292
+ # When recvfrom(2) returns 0, Socket#recv_nonblock returns nil. In most cases it
1293
+ # means the connection was closed, but for UDP connections it may mean an empty
1294
+ # packet was received, as the underlying API makes it impossible to distinguish
1295
+ # these two cases.
1295
1296
  #
1296
1297
  # ### Parameters
1297
1298
  # * `maxlen` - the maximum number of bytes to receive from the socket
@@ -44,8 +44,10 @@ class UDPSocket < IPSocket
44
44
  # received. The second element, *sender_inet_addr*, is an array to represent the
45
45
  # sender address.
46
46
  #
47
- # When recvfrom(2) returns 0, Socket#recvfrom_nonblock returns an empty string
48
- # as data. It means an empty packet.
47
+ # When recvfrom(2) returns 0, Socket#recv_nonblock returns nil. In most cases it
48
+ # means the connection was closed, but it may also mean an empty packet was
49
+ # received, as the underlying API makes it impossible to distinguish these two
50
+ # cases.
49
51
  #
50
52
  # ### Parameters
51
53
  # * `maxlen` - the number of bytes to receive from the socket
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-21 00:00:00.000000000 Z
11
+ date: 2023-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: abbrev
@@ -529,7 +529,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
529
529
  - !ruby/object:Gem::Version
530
530
  version: '0'
531
531
  requirements: []
532
- rubygems_version: 3.5.0.dev
532
+ rubygems_version: 3.5.3
533
533
  signing_key:
534
534
  specification_version: 4
535
535
  summary: Type signature for Ruby.