rbs 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +5 -0
  3. data/CHANGELOG.md +23 -0
  4. data/README.md +6 -1
  5. data/core/array.rbs +2866 -1086
  6. data/core/basic_object.rbs +150 -30
  7. data/core/binding.rbs +33 -0
  8. data/core/builtin.rbs +4 -4
  9. data/core/class.rbs +43 -5
  10. data/core/comparable.rbs +57 -0
  11. data/core/complex.rbs +170 -4
  12. data/core/constants.rbs +51 -0
  13. data/core/deprecated.rbs +7 -0
  14. data/core/dir.rbs +305 -20
  15. data/core/encoding.rbs +472 -77
  16. data/core/enumerable.rbs +2173 -234
  17. data/core/enumerator.rbs +448 -182
  18. data/core/env.rbs +448 -1
  19. data/core/errno.rbs +1 -10
  20. data/core/errors.rbs +152 -2
  21. data/core/exception.rbs +201 -127
  22. data/core/false_class.rbs +27 -0
  23. data/core/fiber.rbs +118 -37
  24. data/core/fiber_error.rbs +8 -9
  25. data/core/file.rbs +1059 -139
  26. data/core/file_test.rbs +287 -32
  27. data/core/float.rbs +776 -300
  28. data/core/gc.rbs +185 -34
  29. data/core/global_variables.rbs +5 -1
  30. data/core/hash.rbs +1582 -649
  31. data/core/integer.rbs +974 -204
  32. data/core/io/buffer.rbs +710 -0
  33. data/core/io/wait.rbs +29 -8
  34. data/core/io.rbs +2438 -417
  35. data/core/kernel.rbs +2315 -316
  36. data/core/marshal.rbs +37 -2
  37. data/core/match_data.rbs +123 -6
  38. data/core/math.rbs +126 -6
  39. data/core/method.rbs +226 -102
  40. data/core/module.rbs +421 -45
  41. data/core/nil_class.rbs +64 -0
  42. data/core/numeric.rbs +620 -142
  43. data/core/object.rbs +453 -81
  44. data/core/object_space.rbs +92 -2
  45. data/core/proc.rbs +482 -285
  46. data/core/process.rbs +443 -34
  47. data/core/ractor.rbs +232 -9
  48. data/core/random.rbs +151 -52
  49. data/core/range.rbs +885 -160
  50. data/core/rational.rbs +122 -6
  51. data/core/rb_config.rbs +14 -4
  52. data/core/refinement.rbs +44 -0
  53. data/core/regexp.rbs +156 -14
  54. data/core/ruby_vm.rbs +42 -3
  55. data/core/signal.rbs +78 -39
  56. data/core/string.rbs +2123 -567
  57. data/core/string_io.rbs +204 -0
  58. data/core/struct.rbs +283 -28
  59. data/core/symbol.rbs +304 -30
  60. data/core/thread.rbs +1288 -688
  61. data/core/thread_group.rbs +66 -10
  62. data/core/time.rbs +643 -217
  63. data/core/trace_point.rbs +100 -12
  64. data/core/true_class.rbs +24 -0
  65. data/core/unbound_method.rbs +73 -7
  66. data/core/warning.rbs +37 -12
  67. data/docs/CONTRIBUTING.md +40 -34
  68. data/docs/stdlib.md +3 -102
  69. data/lib/rbs/annotate/annotations.rb +197 -0
  70. data/lib/rbs/annotate/formatter.rb +80 -0
  71. data/lib/rbs/annotate/rdoc_annotator.rb +398 -0
  72. data/lib/rbs/annotate/rdoc_source.rb +120 -0
  73. data/lib/rbs/annotate.rb +6 -0
  74. data/lib/rbs/cli.rb +45 -1
  75. data/lib/rbs/definition_builder.rb +5 -1
  76. data/lib/rbs/location_aux.rb +12 -0
  77. data/lib/rbs/prototype/rb.rb +12 -0
  78. data/lib/rbs/version.rb +1 -1
  79. data/sig/annotate/annotations.rbs +102 -0
  80. data/sig/annotate/formatter.rbs +24 -0
  81. data/sig/annotate/rdoc_annotater.rbs +82 -0
  82. data/sig/annotate/rdoc_source.rbs +30 -0
  83. data/sig/cli.rbs +2 -0
  84. data/sig/collection/{collections.rbs → sources.rbs} +0 -0
  85. data/sig/location.rbs +6 -0
  86. data/sig/method_types.rbs +5 -1
  87. data/sig/polyfill.rbs +78 -0
  88. data/stdlib/abbrev/0/abbrev.rbs +6 -0
  89. data/stdlib/abbrev/0/array.rbs +26 -0
  90. data/stdlib/base64/0/base64.rbs +31 -0
  91. data/stdlib/benchmark/0/benchmark.rbs +74 -3
  92. data/stdlib/bigdecimal/0/big_decimal.rbs +614 -165
  93. data/stdlib/bigdecimal-math/0/big_math.rbs +41 -64
  94. data/stdlib/cgi/0/core.rbs +59 -0
  95. data/stdlib/coverage/0/coverage.rbs +164 -2
  96. data/stdlib/csv/0/csv.rbs +2862 -398
  97. data/stdlib/date/0/date.rbs +483 -25
  98. data/stdlib/date/0/date_time.rbs +187 -12
  99. data/stdlib/dbm/0/dbm.rbs +152 -17
  100. data/stdlib/digest/0/digest.rbs +146 -0
  101. data/stdlib/erb/0/erb.rbs +65 -245
  102. data/stdlib/fiber/0/fiber.rbs +73 -91
  103. data/stdlib/fileutils/0/fileutils.rbs +301 -1
  104. data/stdlib/find/0/find.rbs +9 -0
  105. data/stdlib/forwardable/0/forwardable.rbs +65 -1
  106. data/stdlib/io-console/0/io-console.rbs +227 -15
  107. data/stdlib/ipaddr/0/ipaddr.rbs +161 -0
  108. data/stdlib/json/0/json.rbs +1146 -144
  109. data/stdlib/logger/0/formatter.rbs +24 -0
  110. data/stdlib/logger/0/log_device.rbs +64 -0
  111. data/stdlib/logger/0/logger.rbs +165 -13
  112. data/stdlib/logger/0/period.rbs +10 -0
  113. data/stdlib/logger/0/severity.rbs +26 -0
  114. data/stdlib/monitor/0/monitor.rbs +163 -0
  115. data/stdlib/mutex_m/0/mutex_m.rbs +35 -6
  116. data/stdlib/net-http/0/net-http.rbs +1492 -683
  117. data/stdlib/nkf/0/nkf.rbs +372 -0
  118. data/stdlib/objspace/0/objspace.rbs +149 -90
  119. data/stdlib/openssl/0/openssl.rbs +8108 -71
  120. data/stdlib/optparse/0/optparse.rbs +487 -19
  121. data/stdlib/pathname/0/pathname.rbs +425 -124
  122. data/stdlib/prettyprint/0/prettyprint.rbs +120 -99
  123. data/stdlib/prime/0/integer-extension.rbs +20 -2
  124. data/stdlib/prime/0/prime.rbs +88 -21
  125. data/stdlib/pstore/0/pstore.rbs +102 -0
  126. data/stdlib/pty/0/pty.rbs +64 -14
  127. data/stdlib/resolv/0/resolv.rbs +420 -31
  128. data/stdlib/rubygems/0/basic_specification.rbs +4 -1
  129. data/stdlib/rubygems/0/config_file.rbs +33 -1
  130. data/stdlib/rubygems/0/dependency_installer.rbs +4 -3
  131. data/stdlib/rubygems/0/installer.rbs +13 -1
  132. data/stdlib/rubygems/0/path_support.rbs +4 -1
  133. data/stdlib/rubygems/0/platform.rbs +5 -1
  134. data/stdlib/rubygems/0/request_set.rbs +44 -2
  135. data/stdlib/rubygems/0/requirement.rbs +65 -2
  136. data/stdlib/rubygems/0/rubygems.rbs +407 -0
  137. data/stdlib/rubygems/0/source_list.rbs +13 -0
  138. data/stdlib/rubygems/0/specification.rbs +21 -1
  139. data/stdlib/rubygems/0/stream_ui.rbs +3 -1
  140. data/stdlib/rubygems/0/uninstaller.rbs +8 -1
  141. data/stdlib/rubygems/0/version.rbs +60 -157
  142. data/stdlib/securerandom/0/securerandom.rbs +44 -0
  143. data/stdlib/set/0/set.rbs +420 -106
  144. data/stdlib/shellwords/0/shellwords.rbs +55 -77
  145. data/stdlib/singleton/0/singleton.rbs +20 -0
  146. data/stdlib/socket/0/addrinfo.rbs +210 -9
  147. data/stdlib/socket/0/basic_socket.rbs +103 -11
  148. data/stdlib/socket/0/ip_socket.rbs +31 -9
  149. data/stdlib/socket/0/socket.rbs +586 -38
  150. data/stdlib/socket/0/tcp_server.rbs +22 -2
  151. data/stdlib/socket/0/tcp_socket.rbs +12 -1
  152. data/stdlib/socket/0/udp_socket.rbs +25 -2
  153. data/stdlib/socket/0/unix_server.rbs +22 -2
  154. data/stdlib/socket/0/unix_socket.rbs +45 -5
  155. data/stdlib/strscan/0/string_scanner.rbs +210 -9
  156. data/stdlib/tempfile/0/tempfile.rbs +58 -10
  157. data/stdlib/time/0/time.rbs +208 -116
  158. data/stdlib/timeout/0/timeout.rbs +10 -0
  159. data/stdlib/tmpdir/0/tmpdir.rbs +13 -4
  160. data/stdlib/tsort/0/cyclic.rbs +1 -0
  161. data/stdlib/tsort/0/interfaces.rbs +1 -0
  162. data/stdlib/tsort/0/tsort.rbs +42 -0
  163. data/stdlib/uri/0/common.rbs +57 -8
  164. data/stdlib/uri/0/file.rbs +55 -109
  165. data/stdlib/uri/0/ftp.rbs +6 -3
  166. data/stdlib/uri/0/generic.rbs +556 -327
  167. data/stdlib/uri/0/http.rbs +26 -115
  168. data/stdlib/uri/0/https.rbs +8 -102
  169. data/stdlib/uri/0/ldap.rbs +143 -137
  170. data/stdlib/uri/0/ldaps.rbs +8 -102
  171. data/stdlib/uri/0/mailto.rbs +3 -0
  172. data/stdlib/uri/0/rfc2396_parser.rbs +66 -26
  173. data/stdlib/uri/0/ws.rbs +6 -3
  174. data/stdlib/uri/0/wss.rbs +5 -3
  175. data/stdlib/yaml/0/dbm.rbs +151 -87
  176. data/stdlib/yaml/0/store.rbs +6 -0
  177. data/stdlib/zlib/0/zlib.rbs +90 -31
  178. metadata +17 -5
  179. data/lib/rbs/location.rb +0 -221
@@ -1,29 +1,30 @@
1
+ %a{annotate:rdoc:skip}
1
2
  class Time
2
3
  interface _TimeLike
3
4
  def year: () -> Integer
5
+
4
6
  def mon: () -> Integer
7
+
5
8
  def day: () -> Integer
6
9
  end
7
10
 
11
+ # <!--
12
+ # rdoc-file=lib/time.rb
13
+ # - zone_offset(zone, year=self.now.year)
14
+ # -->
15
+ # Return the number of seconds the specified time zone differs from UTC.
8
16
  #
9
- # Return the number of seconds the specified time zone differs
10
- # from UTC.
11
- #
12
- # Numeric time zones that include minutes, such as
13
- # <code>-10:00</code> or <code>+1330</code> will work, as will
14
- # simpler hour-only time zones like <code>-10</code> or
15
- # <code>+13</code>.
17
+ # Numeric time zones that include minutes, such as `-10:00` or `+1330` will
18
+ # work, as will simpler hour-only time zones like `-10` or `+13`.
16
19
  #
17
20
  # Textual time zones listed in ZoneOffset are also supported.
18
21
  #
19
- # If the time zone does not match any of the above, +zone_offset+
20
- # will check if the local time zone (both with and without
21
- # potential Daylight Saving \Time changes being in effect) matches
22
- # +zone+. Specifying a value for +year+ will change the year used
23
- # to find the local time zone.
22
+ # If the time zone does not match any of the above, `zone_offset` will check if
23
+ # the local time zone (both with and without potential Daylight Saving Time
24
+ # changes being in effect) matches `zone`. Specifying a value for `year` will
25
+ # change the year used to find the local time zone.
24
26
  #
25
- # If +zone_offset+ is unable to determine the offset, nil will be
26
- # returned.
27
+ # If `zone_offset` is unable to determine the offset, nil will be returned.
27
28
  #
28
29
  # require 'time'
29
30
  #
@@ -33,9 +34,16 @@ class Time
33
34
  #
34
35
  def self.zone_offset: (String zone, ?Integer year) -> Integer
35
36
 
37
+ # <!--
38
+ # rdoc-file=lib/time.rb
39
+ # - parse(date, now=self.now) { |year| ... }
40
+ # -->
41
+ # Takes a string representation of a Time and attempts to parse it using a
42
+ # heuristic.
36
43
  #
37
- # Takes a string representation of a Time and attempts to parse it
38
- # using a heuristic.
44
+ # This method **does not** function as a validator. If the input string does
45
+ # not match valid formats strictly, you may get a cryptic result. Should
46
+ # consider to use `Time.strptime` instead of this method as possible.
39
47
  #
40
48
  # require 'time'
41
49
  #
@@ -72,10 +80,10 @@ class Time
72
80
  # Time.parse("12:00", dt) #=> 2010-10-30 12:00:00 -0500
73
81
  # Time.parse("12:00", md) #=> 2010-10-31 12:00:00 -0500
74
82
  #
75
- # If a block is given, the year described in +date+ is converted
76
- # by the block. This is specifically designed for handling two
77
- # digit years. For example, if you wanted to treat all two digit
78
- # years prior to 70 as the year 2000+ you could write this:
83
+ # If a block is given, the year described in `date` is converted by the block.
84
+ # This is specifically designed for handling two digit years. For example, if
85
+ # you wanted to treat all two digit years prior to 70 as the year 2000+ you
86
+ # could write this:
79
87
  #
80
88
  # require 'time'
81
89
  #
@@ -85,8 +93,8 @@ class Time
85
93
  # #=> 1970-10-31 00:00:00 -0500
86
94
  #
87
95
  # If the upper components of the given time are broken or missing, they are
88
- # supplied with those of +now+. For the lower components, the minimum
89
- # values (1 or 0) are assumed if broken or missing. For example:
96
+ # supplied with those of `now`. For the lower components, the minimum values (1
97
+ # or 0) are assumed if broken or missing. For example:
90
98
  #
91
99
  # require 'time'
92
100
  #
@@ -99,9 +107,8 @@ class Time
99
107
  # Time.parse("Aug 2000", now) #=> 2000-08-01 00:00:00 -0500
100
108
  #
101
109
  # Since there are numerous conflicts among locally defined time zone
102
- # abbreviations all over the world, this method is not intended to
103
- # understand all of them. For example, the abbreviation "CST" is
104
- # used variously as:
110
+ # abbreviations all over the world, this method is not intended to understand
111
+ # all of them. For example, the abbreviation "CST" is used variously as:
105
112
  #
106
113
  # -06:00 in America/Chicago,
107
114
  # -05:00 in America/Havana,
@@ -110,23 +117,21 @@ class Time
110
117
  # +10:30 in Australia/Adelaide,
111
118
  # etc.
112
119
  #
113
- # Based on this fact, this method only understands the time zone
114
- # abbreviations described in RFC 822 and the system time zone, in the
115
- # order named. (i.e. a definition in RFC 822 overrides the system
116
- # time zone definition.) The system time zone is taken from
117
- # <tt>Time.local(year, 1, 1).zone</tt> and
118
- # <tt>Time.local(year, 7, 1).zone</tt>.
119
- # If the extracted time zone abbreviation does not match any of them,
120
+ # Based on this fact, this method only understands the time zone abbreviations
121
+ # described in RFC 822 and the system time zone, in the order named. (i.e. a
122
+ # definition in RFC 822 overrides the system time zone definition.) The system
123
+ # time zone is taken from `Time.local(year, 1, 1).zone` and `Time.local(year, 7,
124
+ # 1).zone`. If the extracted time zone abbreviation does not match any of them,
120
125
  # it is ignored and the given time is regarded as a local time.
121
126
  #
122
- # ArgumentError is raised if Date._parse cannot extract information from
123
- # +date+ or if the Time class cannot represent specified date.
127
+ # ArgumentError is raised if Date._parse cannot extract information from `date`
128
+ # or if the Time class cannot represent specified date.
124
129
  #
125
130
  # This method can be used as a fail-safe for other parsing methods as:
126
131
  #
127
- # Time.rfc2822(date) rescue Time.parse(date)
128
- # Time.httpdate(date) rescue Time.parse(date)
129
- # Time.xmlschema(date) rescue Time.parse(date)
132
+ # Time.rfc2822(date) rescue Time.parse(date)
133
+ # Time.httpdate(date) rescue Time.parse(date)
134
+ # Time.xmlschema(date) rescue Time.parse(date)
130
135
  #
131
136
  # A failure of Time.parse should be checked, though.
132
137
  #
@@ -134,66 +139,115 @@ class Time
134
139
  #
135
140
  def self.parse: (String date, ?_TimeLike now) ?{ (Integer) -> Integer } -> Time
136
141
 
142
+ # <!--
143
+ # rdoc-file=lib/time.rb
144
+ # - strptime(date, format, now=self.now) { |year| ... }
145
+ # -->
146
+ # Works similar to `parse` except that instead of using a heuristic to detect
147
+ # the format of the input string, you provide a second argument that describes
148
+ # the format of the string.
137
149
  #
138
- # Works similar to +parse+ except that instead of using a
139
- # heuristic to detect the format of the input string, you provide
140
- # a second argument that describes the format of the string.
141
- #
142
- # If a block is given, the year described in +date+ is converted by the
143
- # block. For example:
150
+ # If a block is given, the year described in `date` is converted by the block.
151
+ # For example:
144
152
  #
145
- # Time.strptime(...) {|y| y < 100 ? (y >= 69 ? y + 1900 : y + 2000) : y}
153
+ # Time.strptime(...) {|y| y < 100 ? (y >= 69 ? y + 1900 : y + 2000) : y}
146
154
  #
147
155
  # Below is a list of the formatting options:
148
156
  #
149
- # %a :: The abbreviated weekday name ("Sun")
150
- # %A :: The full weekday name ("Sunday")
151
- # %b :: The abbreviated month name ("Jan")
152
- # %B :: The full month name ("January")
153
- # %c :: The preferred local date and time representation
154
- # %C :: Century (20 in 2009)
155
- # %d :: Day of the month (01..31)
156
- # %D :: Date (%m/%d/%y)
157
- # %e :: Day of the month, blank-padded ( 1..31)
158
- # %F :: Equivalent to %Y-%m-%d (the ISO 8601 date format)
159
- # %g :: The last two digits of the commercial year
160
- # %G :: The week-based year according to ISO-8601 (week 1 starts on Monday
161
- # and includes January 4)
162
- # %h :: Equivalent to %b
163
- # %H :: Hour of the day, 24-hour clock (00..23)
164
- # %I :: Hour of the day, 12-hour clock (01..12)
165
- # %j :: Day of the year (001..366)
166
- # %k :: hour, 24-hour clock, blank-padded ( 0..23)
167
- # %l :: hour, 12-hour clock, blank-padded ( 0..12)
168
- # %L :: Millisecond of the second (000..999)
169
- # %m :: Month of the year (01..12)
170
- # %M :: Minute of the hour (00..59)
171
- # %n :: Newline (\n)
172
- # %N :: Fractional seconds digits
173
- # %p :: Meridian indicator ("AM" or "PM")
174
- # %P :: Meridian indicator ("am" or "pm")
175
- # %r :: time, 12-hour (same as %I:%M:%S %p)
176
- # %R :: time, 24-hour (%H:%M)
177
- # %s :: Number of seconds since 1970-01-01 00:00:00 UTC.
178
- # %S :: Second of the minute (00..60)
179
- # %t :: Tab character (\t)
180
- # %T :: time, 24-hour (%H:%M:%S)
181
- # %u :: Day of the week as a decimal, Monday being 1. (1..7)
182
- # %U :: Week number of the current year, starting with the first Sunday as
183
- # the first day of the first week (00..53)
184
- # %v :: VMS date (%e-%b-%Y)
185
- # %V :: Week number of year according to ISO 8601 (01..53)
186
- # %W :: Week number of the current year, starting with the first Monday
187
- # as the first day of the first week (00..53)
188
- # %w :: Day of the week (Sunday is 0, 0..6)
189
- # %x :: Preferred representation for the date alone, no time
190
- # %X :: Preferred representation for the time alone, no date
191
- # %y :: Year without a century (00..99)
192
- # %Y :: Year which may include century, if provided
193
- # %z :: Time zone as hour offset from UTC (e.g. +0900)
194
- # %Z :: Time zone name
195
- # %% :: Literal "%" character
196
- # %+ :: date(1) (%a %b %e %H:%M:%S %Z %Y)
157
+ # %a
158
+ # : The abbreviated weekday name ("Sun")
159
+ # %A
160
+ # : The full weekday name ("Sunday")
161
+ # %b
162
+ # : The abbreviated month name ("Jan")
163
+ # %B
164
+ # : The full month name ("January")
165
+ # %c
166
+ # : The preferred local date and time representation
167
+ # %C
168
+ # : Century (20 in 2009)
169
+ # %d
170
+ # : Day of the month (01..31)
171
+ # %D
172
+ # : Date (%m/%d/%y)
173
+ # %e
174
+ # : Day of the month, blank-padded ( 1..31)
175
+ # %F
176
+ # : Equivalent to %Y-%m-%d (the ISO 8601 date format)
177
+ # %g
178
+ # : The last two digits of the commercial year
179
+ # %G
180
+ # : The week-based year according to ISO-8601 (week 1 starts on Monday and
181
+ # includes January 4)
182
+ # %h
183
+ # : Equivalent to %b
184
+ # %H
185
+ # : Hour of the day, 24-hour clock (00..23)
186
+ # %I
187
+ # : Hour of the day, 12-hour clock (01..12)
188
+ # %j
189
+ # : Day of the year (001..366)
190
+ # %k
191
+ # : hour, 24-hour clock, blank-padded ( 0..23)
192
+ # %l
193
+ # : hour, 12-hour clock, blank-padded ( 0..12)
194
+ # %L
195
+ # : Millisecond of the second (000..999)
196
+ # %m
197
+ # : Month of the year (01..12)
198
+ # %M
199
+ # : Minute of the hour (00..59)
200
+ # %n
201
+ # : Newline (n)
202
+ # %N
203
+ # : Fractional seconds digits
204
+ # %p
205
+ # : Meridian indicator ("AM" or "PM")
206
+ # %P
207
+ # : Meridian indicator ("am" or "pm")
208
+ # %r
209
+ # : time, 12-hour (same as %I:%M:%S %p)
210
+ # %R
211
+ # : time, 24-hour (%H:%M)
212
+ # %s
213
+ # : Number of seconds since 1970-01-01 00:00:00 UTC.
214
+ # %S
215
+ # : Second of the minute (00..60)
216
+ # %t
217
+ # : Tab character (t)
218
+ # %T
219
+ # : time, 24-hour (%H:%M:%S)
220
+ # %u
221
+ # : Day of the week as a decimal, Monday being 1. (1..7)
222
+ # %U
223
+ # : Week number of the current year, starting with the first Sunday as the
224
+ # first day of the first week (00..53)
225
+ # %v
226
+ # : VMS date (%e-%b-%Y)
227
+ # %V
228
+ # : Week number of year according to ISO 8601 (01..53)
229
+ # %W
230
+ # : Week number of the current year, starting with the first Monday as the
231
+ # first day of the first week (00..53)
232
+ # %w
233
+ # : Day of the week (Sunday is 0, 0..6)
234
+ # %x
235
+ # : Preferred representation for the date alone, no time
236
+ # %X
237
+ # : Preferred representation for the time alone, no date
238
+ # %y
239
+ # : Year without a century (00..99)
240
+ # %Y
241
+ # : Year which may include century, if provided
242
+ # %z
243
+ # : Time zone as hour offset from UTC (e.g. +0900)
244
+ # %Z
245
+ # : Time zone name
246
+ # %%
247
+ # : Literal "%" character
248
+ # %+
249
+ # : date(1) (%a %b %e %H:%M:%S %Z %Y)
250
+ #
197
251
  #
198
252
  # require 'time'
199
253
  #
@@ -203,13 +257,16 @@ class Time
203
257
  #
204
258
  def self.strptime: (String date, String format, ?_TimeLike now) ?{ (Integer) -> Integer } -> Time
205
259
 
206
- #
207
- # Parses +date+ as date-time defined by RFC 2822 and converts it to a Time
260
+ # <!--
261
+ # rdoc-file=lib/time.rb
262
+ # - rfc2822(date)
263
+ # -->
264
+ # Parses `date` as date-time defined by RFC 2822 and converts it to a Time
208
265
  # object. The format is identical to the date format defined by RFC 822 and
209
266
  # updated by RFC 1123.
210
267
  #
211
- # ArgumentError is raised if +date+ is not compliant with RFC 2822
212
- # or if the Time class cannot represent specified date.
268
+ # ArgumentError is raised if `date` is not compliant with RFC 2822 or if the
269
+ # Time class cannot represent specified date.
213
270
  #
214
271
  # See #rfc2822 for more information on this format.
215
272
  #
@@ -222,14 +279,22 @@ class Time
222
279
  #
223
280
  def self.rfc2822: (String date) -> Time
224
281
 
282
+ # <!--
283
+ # rdoc-file=lib/time.rb
284
+ # - rfc822(date)
285
+ # -->
286
+ #
225
287
  alias self.rfc822 self.rfc2822
226
288
 
289
+ # <!--
290
+ # rdoc-file=lib/time.rb
291
+ # - httpdate(date)
292
+ # -->
293
+ # Parses `date` as an HTTP-date defined by RFC 2616 and converts it to a Time
294
+ # object.
227
295
  #
228
- # Parses +date+ as an HTTP-date defined by RFC 2616 and converts it to a
229
- # Time object.
230
- #
231
- # ArgumentError is raised if +date+ is not compliant with RFC 2616 or if
232
- # the Time class cannot represent specified date.
296
+ # ArgumentError is raised if `date` is not compliant with RFC 2616 or if the
297
+ # Time class cannot represent specified date.
233
298
  #
234
299
  # See #httpdate for more information on this format.
235
300
  #
@@ -242,13 +307,16 @@ class Time
242
307
  #
243
308
  def self.httpdate: (String date) -> Time
244
309
 
310
+ # <!--
311
+ # rdoc-file=lib/time.rb
312
+ # - xmlschema(time)
313
+ # -->
314
+ # Parses `time` as a dateTime defined by the XML Schema and converts it to a
315
+ # Time object. The format is a restricted version of the format defined by ISO
316
+ # 8601.
245
317
  #
246
- # Parses +date+ as a dateTime defined by the XML Schema and converts it to
247
- # a Time object. The format is a restricted version of the format defined
248
- # by ISO 8601.
249
- #
250
- # ArgumentError is raised if +date+ is not compliant with the format or if
251
- # the Time class cannot represent specified date.
318
+ # ArgumentError is raised if `time` is not compliant with the format or if the
319
+ # Time class cannot represent the specified time.
252
320
  #
253
321
  # See #xmlschema for more information on this format.
254
322
  #
@@ -261,16 +329,24 @@ class Time
261
329
  #
262
330
  def self.xmlschema: (String date) -> Time
263
331
 
332
+ # <!--
333
+ # rdoc-file=lib/time.rb
334
+ # - iso8601(time)
335
+ # -->
336
+ #
264
337
  alias self.iso8601 self.xmlschema
265
338
 
266
- #
339
+ # <!--
340
+ # rdoc-file=lib/time.rb
341
+ # - rfc2822()
342
+ # -->
267
343
  # Returns a string which represents the time as date-time defined by RFC 2822:
268
344
  #
269
- # day-of-week, DD month-name CCYY hh:mm:ss zone
345
+ # day-of-week, DD month-name CCYY hh:mm:ss zone
270
346
  #
271
347
  # where zone is [+-]hhmm.
272
348
  #
273
- # If +self+ is a UTC time, -0000 is used as zone.
349
+ # If `self` is a UTC time, -0000 is used as zone.
274
350
  #
275
351
  # require 'time'
276
352
  #
@@ -281,13 +357,21 @@ class Time
281
357
  #
282
358
  def rfc2822: () -> String
283
359
 
360
+ # <!--
361
+ # rdoc-file=lib/time.rb
362
+ # - rfc822()
363
+ # -->
364
+ #
284
365
  alias rfc822 rfc2822
285
366
 
286
- #
367
+ # <!--
368
+ # rdoc-file=lib/time.rb
369
+ # - httpdate()
370
+ # -->
287
371
  # Returns a string which represents the time as RFC 1123 date of HTTP-date
288
372
  # defined by RFC 2616:
289
373
  #
290
- # day-of-week, DD month-name CCYY hh:mm:ss GMT
374
+ # day-of-week, DD month-name CCYY hh:mm:ss GMT
291
375
  #
292
376
  # Note that the result is always UTC (GMT).
293
377
  #
@@ -300,18 +384,21 @@ class Time
300
384
  #
301
385
  def httpdate: () -> String
302
386
 
303
- #
387
+ # <!--
388
+ # rdoc-file=lib/time.rb
389
+ # - xmlschema(fraction_digits=0)
390
+ # -->
304
391
  # Returns a string which represents the time as a dateTime defined by XML
305
392
  # Schema:
306
393
  #
307
- # CCYY-MM-DDThh:mm:ssTZD
308
- # CCYY-MM-DDThh:mm:ss.sssTZD
394
+ # CCYY-MM-DDThh:mm:ssTZD
395
+ # CCYY-MM-DDThh:mm:ss.sssTZD
309
396
  #
310
397
  # where TZD is Z or [+-]hh:mm.
311
398
  #
312
399
  # If self is a UTC time, Z is used as TZD. [+-]hh:mm is used otherwise.
313
400
  #
314
- # +fractional_digits+ specifies a number of digits to use for fractional
401
+ # `fractional_digits` specifies a number of digits to use for fractional
315
402
  # seconds. Its default value is 0.
316
403
  #
317
404
  # require 'time'
@@ -323,5 +410,10 @@ class Time
323
410
  #
324
411
  def xmlschema: (?Integer fraction_digits) -> String
325
412
 
413
+ # <!--
414
+ # rdoc-file=lib/time.rb
415
+ # - iso8601(fraction_digits=0)
416
+ # -->
417
+ #
326
418
  alias iso8601 xmlschema
327
419
  end
@@ -1,3 +1,4 @@
1
+ # <!-- rdoc-file=lib/timeout.rb -->
1
2
  # Timeout long-running blocks
2
3
  #
3
4
  # ## Synopsis
@@ -24,6 +25,10 @@
24
25
  # : (C) 2000 Information-technology Promotion Agency, Japan
25
26
  #
26
27
  module Timeout
28
+ # <!--
29
+ # rdoc-file=lib/timeout.rb
30
+ # - timeout(sec, klass = nil, message = nil) { |sec| ... }
31
+ # -->
27
32
  # Perform an operation in a block, raising an error if it takes longer than
28
33
  # `sec` seconds to complete.
29
34
  #
@@ -47,6 +52,9 @@ module Timeout
47
52
  # prevent the handling of the exception. For that reason, this method cannot be
48
53
  # relied on to enforce timeouts for untrusted blocks.
49
54
  #
55
+ # If a scheduler is defined, it will be used to handle the timeout by invoking
56
+ # Scheduler#timeout_after.
57
+ #
50
58
  # Note that this is both a method of module Timeout, so you can `include
51
59
  # Timeout` into your classes so they have a #timeout method, as well as a module
52
60
  # method, so you can call it directly as Timeout.timeout().
@@ -54,7 +62,9 @@ module Timeout
54
62
  def self?.timeout: [T] (Numeric? sec, ?singleton(Exception) klass, ?String message) { (Numeric sec) -> T } -> T
55
63
  end
56
64
 
65
+ # <!-- rdoc-file=lib/timeout.rb -->
57
66
  # Raised by Timeout.timeout when the block times out.
67
+ #
58
68
  class Timeout::Error < RuntimeError
59
69
  attr_reader thread: Thread?
60
70
  end
@@ -1,8 +1,17 @@
1
+ %a{annotate:rdoc:skip}
1
2
  class Dir
3
+ # <!--
4
+ # rdoc-file=lib/tmpdir.rb
5
+ # - tmpdir()
6
+ # -->
2
7
  # Returns the operating system's temporary file path.
3
8
  #
4
9
  def self.tmpdir: () -> String
5
10
 
11
+ # <!--
12
+ # rdoc-file=lib/tmpdir.rb
13
+ # - mktmpdir(prefix_suffix=nil, *rest, **options) { |dup| ... }
14
+ # -->
6
15
  # Dir.mktmpdir creates a temporary directory.
7
16
  #
8
17
  # The directory is created with 0700 permission. Application should not change
@@ -33,7 +42,7 @@ class Dir
33
42
  #
34
43
  # Dir.mktmpdir {|dir|
35
44
  # # use the directory...
36
- # open("#{dir}/foo", "w") { ... }
45
+ # open("#{dir}/foo", "w") { something using the file }
37
46
  # }
38
47
  #
39
48
  # If a block is not given, The path of the directory is returned. In this case,
@@ -42,12 +51,12 @@ class Dir
42
51
  # dir = Dir.mktmpdir
43
52
  # begin
44
53
  # # use the directory...
45
- # open("#{dir}/foo", "w") { ... }
54
+ # open("#{dir}/foo", "w") { something using the file }
46
55
  # ensure
47
56
  # # remove the directory.
48
57
  # FileUtils.remove_entry dir
49
58
  # end
50
59
  #
51
- def self.mktmpdir: (?(String | [ String, String ] | nil), ?String?, ?max_try: Integer?) -> String
52
- | [X] (?(String | [ String, String ] | nil), ?String?, ?max_try: Integer?) { (String) -> X } -> X
60
+ def self.mktmpdir: (?String | [ String, String ] | nil, ?String?, ?max_try: Integer?) -> String
61
+ | [X] (?String | [ String, String ] | nil, ?String?, ?max_try: Integer?) { (String) -> X } -> X
53
62
  end
@@ -1,3 +1,4 @@
1
+ %a{annotate:rdoc:skip}
1
2
  module TSort[Node]
2
3
  class Cyclic < StandardError
3
4
  end
@@ -1,3 +1,4 @@
1
+ %a{annotate:rdoc:skip}
1
2
  module TSort[Node]
2
3
  interface _Sortable[Node]
3
4
  # #tsort_each_node is used to iterate for all nodes over a graph.
@@ -1,3 +1,4 @@
1
+ # <!-- rdoc-file=lib/tsort.rb -->
1
2
  # TSort implements topological sorting using Tarjan's algorithm for strongly
2
3
  # connected components.
3
4
  #
@@ -115,7 +116,12 @@
115
116
  #
116
117
  #
117
118
  # *SIAM Journal on Computing*, Vol. 1, No. 2, pp. 146-160, June 1972.
119
+ #
118
120
  module TSort[Node] : TSort::_Sortable[Node]
121
+ # <!--
122
+ # rdoc-file=lib/tsort.rb
123
+ # - each_strongly_connected_component(each_node, each_child) { |nodes| ... }
124
+ # -->
119
125
  # The iterator version of the TSort.strongly_connected_components method.
120
126
  #
121
127
  # The graph is represented by *each_node* and *each_child*. *each_node* should
@@ -145,6 +151,10 @@ module TSort[Node] : TSort::_Sortable[Node]
145
151
  | [T] (^() { (T) -> void } -> void each_node, ^(T) { (T) -> void } -> void each_child) { (Array[T]) -> void } -> void
146
152
  | [T] (^() { (T) -> void } -> void each_node, ^(T) { (T) -> void } -> void each_child) -> Enumerator[Array[T], void]
147
153
 
154
+ # <!--
155
+ # rdoc-file=lib/tsort.rb
156
+ # - each_strongly_connected_component_from(node, each_child, id_map={}, stack=[]) { |nodes| ... }
157
+ # -->
148
158
  # Iterates over strongly connected components in a graph. The graph is
149
159
  # represented by *node* and *each_child*.
150
160
  #
@@ -170,6 +180,10 @@ module TSort[Node] : TSort::_Sortable[Node]
170
180
  | [T] (T node, ^(T) { (T) -> void } -> void each_child, ?untyped id_map, ?untyped stack) { (Array[T]) -> void } -> void
171
181
  | [T] (T node, ^(T) { (T) -> void } -> void each_child, ?untyped id_map, ?untyped stack) -> Enumerator[Array[T], void]
172
182
 
183
+ # <!--
184
+ # rdoc-file=lib/tsort.rb
185
+ # - strongly_connected_components(each_node, each_child)
186
+ # -->
173
187
  # Returns strongly connected components as an array of arrays of nodes. The
174
188
  # array is sorted from children to parents. Each elements of the array
175
189
  # represents a strongly connected component.
@@ -194,6 +208,10 @@ module TSort[Node] : TSort::_Sortable[Node]
194
208
  def self.strongly_connected_components: [T] (_EachNode[T] each_node, _EachChild[T] each_child) -> Array[Array[T]]
195
209
  | [T] (^() { (T) -> void } -> void each_node, ^(T) { (T) -> void } -> void each_child) -> Array[Array[T]]
196
210
 
211
+ # <!--
212
+ # rdoc-file=lib/tsort.rb
213
+ # - tsort(each_node, each_child)
214
+ # -->
197
215
  # Returns a topologically sorted array of nodes. The array is sorted from
198
216
  # children to parents, i.e. the first element has no child and the last node has
199
217
  # no parent.
@@ -218,6 +236,10 @@ module TSort[Node] : TSort::_Sortable[Node]
218
236
  def self.tsort: [T] (_EachNode[T] each_node, _EachChild[T] each_child) -> Array[T]
219
237
  | [T] (^() { (T) -> void } -> void each_node, ^(T) { (T) -> void } -> void each_child) -> Array[T]
220
238
 
239
+ # <!--
240
+ # rdoc-file=lib/tsort.rb
241
+ # - tsort_each(each_node, each_child) { |node| ... }
242
+ # -->
221
243
  # The iterator version of the TSort.tsort method.
222
244
  #
223
245
  # The graph is represented by *each_node* and *each_child*. *each_node* should
@@ -239,6 +261,10 @@ module TSort[Node] : TSort::_Sortable[Node]
239
261
  | [T] (^() { (T) -> void } -> void each_node, ^(T) { (T) -> void } -> void each_child) { (T) -> void } -> void
240
262
  | [T] (^() { (T) -> void } -> void each_node, ^(T) { (T) -> void } -> void each_child) -> Enumerator[T, void]
241
263
 
264
+ # <!--
265
+ # rdoc-file=lib/tsort.rb
266
+ # - each_strongly_connected_component() { |nodes| ... }
267
+ # -->
242
268
  # The iterator version of the #strongly_connected_components method.
243
269
  # *`obj*.each_strongly_connected_component` is similar to
244
270
  # *`obj*.strongly_connected_components.each`, but modification of *obj* during
@@ -271,6 +297,10 @@ module TSort[Node] : TSort::_Sortable[Node]
271
297
  def each_strongly_connected_component: () { (Array[Node]) -> void } -> void
272
298
  | () -> Enumerator[Array[Node], void]
273
299
 
300
+ # <!--
301
+ # rdoc-file=lib/tsort.rb
302
+ # - each_strongly_connected_component_from(node, id_map={}, stack=[]) { |nodes| ... }
303
+ # -->
274
304
  # Iterates over strongly connected component in the subgraph reachable from
275
305
  # *node*.
276
306
  #
@@ -300,6 +330,10 @@ module TSort[Node] : TSort::_Sortable[Node]
300
330
  def each_strongly_connected_component_from: (Node, ?untyped id_map, ?untyped stack) { (Array[Node]) -> void } -> void
301
331
  | (Node, ?untyped id_map, ?untyped stack) -> Enumerator[Array[Node], void]
302
332
 
333
+ # <!--
334
+ # rdoc-file=lib/tsort.rb
335
+ # - strongly_connected_components()
336
+ # -->
303
337
  # Returns strongly connected components as an array of arrays of nodes. The
304
338
  # array is sorted from children to parents. Each elements of the array
305
339
  # represents a strongly connected component.
@@ -321,6 +355,10 @@ module TSort[Node] : TSort::_Sortable[Node]
321
355
  #
322
356
  def strongly_connected_components: () -> Array[Array[Node]]
323
357
 
358
+ # <!--
359
+ # rdoc-file=lib/tsort.rb
360
+ # - tsort()
361
+ # -->
324
362
  # Returns a topologically sorted array of nodes. The array is sorted from
325
363
  # children to parents, i.e. the first element has no child and the last node has
326
364
  # no parent.
@@ -344,6 +382,10 @@ module TSort[Node] : TSort::_Sortable[Node]
344
382
  #
345
383
  def tsort: () -> Array[Node]
346
384
 
385
+ # <!--
386
+ # rdoc-file=lib/tsort.rb
387
+ # - tsort_each() { |node| ... }
388
+ # -->
347
389
  # The iterator version of the #tsort method. *`obj*.tsort_each` is similar to
348
390
  # *`obj*.tsort.each`, but modification of *obj* during the iteration may lead to
349
391
  # unexpected results.