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,3 +1,4 @@
1
+ # <!-- rdoc-file=ext/date/date_core.c -->
1
2
  # date and datetime class - Tadayoshi Funaba 1998-2011
2
3
  #
3
4
  # 'date' provides two classes: Date and DateTime.
@@ -134,64 +135,116 @@
134
135
  # d.strftime('%a %d %b %Y') #=> "Sun 04 Feb 2001"
135
136
  #
136
137
  class Date
137
- # Creates a date object denoting the given calendar date.
138
- #
139
- # In this class, BCE years are counted astronomically. Thus, the year before
140
- # the year 1 is the year zero, and the year preceding the year zero is the year
141
- # -1. The month and the day of month should be a negative or a positive number
142
- # (as a relative month/day from the end of year/month when negative). They
143
- # should not be zero.
144
- #
145
- # The last argument should be a Julian day number which denotes the day of
146
- # calendar reform. Date::ITALY (2299161=1582-10-15), Date::ENGLAND
147
- # (2361222=1752-09-14), Date::GREGORIAN (the proleptic Gregorian calendar) and
148
- # Date::JULIAN (the proleptic Julian calendar) can be specified as a day of
149
- # calendar reform.
150
- #
151
- # Date.new(2001) #=> #<Date: 2001-01-01 ...>
152
- # Date.new(2001,2,3) #=> #<Date: 2001-02-03 ...>
153
- # Date.new(2001,2,-1) #=> #<Date: 2001-02-28 ...>
154
- #
155
- # See also ::jd.
138
+ # <!--
139
+ # rdoc-file=ext/date/date_core.c
140
+ # - new(p1 = v1, p2 = v2, p3 = v3, p4 = v4)
141
+ # -->
156
142
  #
157
143
  def initialize: (?Integer year, ?Integer month, ?Integer mday, ?Integer start) -> void
158
144
 
159
145
  include Comparable
160
146
 
147
+ # <!--
148
+ # rdoc-file=ext/date/date_core.c
149
+ # - Date._httpdate(string, limit: 128) -> hash
150
+ # -->
161
151
  # Returns a hash of parsed elements.
162
152
  #
153
+ # Raise an ArgumentError when the string length is longer than *limit*. You can
154
+ # stop this check by passing `limit: nil`, but note that it may take a long time
155
+ # to parse.
156
+ #
163
157
  def self._httpdate: (String str) -> Hash[Symbol, Integer]
164
158
 
159
+ # <!--
160
+ # rdoc-file=ext/date/date_core.c
161
+ # - Date._iso8601(string, limit: 128) -> hash
162
+ # -->
165
163
  # Returns a hash of parsed elements.
166
164
  #
165
+ # Raise an ArgumentError when the string length is longer than *limit*. You can
166
+ # stop this check by passing `limit: nil`, but note that it may take a long time
167
+ # to parse.
168
+ #
167
169
  def self._iso8601: (String str) -> Hash[Symbol, Integer]
168
170
 
171
+ # <!--
172
+ # rdoc-file=ext/date/date_core.c
173
+ # - Date._jisx0301(string, limit: 128) -> hash
174
+ # -->
169
175
  # Returns a hash of parsed elements.
170
176
  #
177
+ # Raise an ArgumentError when the string length is longer than *limit*. You can
178
+ # stop this check by passing `limit: nil`, but note that it may take a long time
179
+ # to parse.
180
+ #
171
181
  def self._jisx0301: (String str) -> Hash[Symbol, Integer]
172
182
 
183
+ # <!--
184
+ # rdoc-file=ext/date/date_core.c
185
+ # - Date._parse(string[, comp=true], limit: 128) -> hash
186
+ # -->
173
187
  # Parses the given representation of date and time, and returns a hash of parsed
174
- # elements. This method does not function as a validator.
188
+ # elements.
189
+ #
190
+ # This method *does not* function as a validator. If the input string does not
191
+ # match valid formats strictly, you may get a cryptic result. Should consider
192
+ # to use `Date._strptime` or `DateTime._strptime` instead of this method as
193
+ # possible.
175
194
  #
176
195
  # If the optional second argument is true and the detected year is in the range
177
196
  # "00" to "99", considers the year a 2-digit form and makes it full.
178
197
  #
179
198
  # Date._parse('2001-02-03') #=> {:year=>2001, :mon=>2, :mday=>3}
180
199
  #
200
+ # Raise an ArgumentError when the string length is longer than *limit*. You can
201
+ # stop this check by passing `limit: nil`, but note that it may take a long time
202
+ # to parse.
203
+ #
181
204
  def self._parse: (String str, ?boolish complete) -> Hash[Symbol, Integer]
182
205
 
206
+ # <!--
207
+ # rdoc-file=ext/date/date_core.c
208
+ # - Date._rfc2822(string, limit: 128) -> hash
209
+ # - Date._rfc822(string, limit: 128) -> hash
210
+ # -->
183
211
  # Returns a hash of parsed elements.
184
212
  #
213
+ # Raise an ArgumentError when the string length is longer than *limit*. You can
214
+ # stop this check by passing `limit: nil`, but note that it may take a long time
215
+ # to parse.
216
+ #
185
217
  def self._rfc2822: (String str) -> Hash[Symbol, Integer | String]
186
218
 
219
+ # <!--
220
+ # rdoc-file=ext/date/date_core.c
221
+ # - Date._rfc3339(string, limit: 128) -> hash
222
+ # -->
187
223
  # Returns a hash of parsed elements.
188
224
  #
225
+ # Raise an ArgumentError when the string length is longer than *limit*. You can
226
+ # stop this check by passing `limit: nil`, but note that it may take a long time
227
+ # to parse.
228
+ #
189
229
  def self._rfc3339: (String str) -> Hash[Symbol, Integer | String]
190
230
 
231
+ # <!--
232
+ # rdoc-file=ext/date/date_core.c
233
+ # - Date._rfc2822(string, limit: 128) -> hash
234
+ # - Date._rfc822(string, limit: 128) -> hash
235
+ # -->
191
236
  # Returns a hash of parsed elements.
192
237
  #
238
+ # Raise an ArgumentError when the string length is longer than *limit*. You can
239
+ # stop this check by passing `limit: nil`, but note that it may take a long time
240
+ # to parse.
241
+ #
193
242
  def self._rfc822: (String str) -> Hash[Symbol, Integer | String]
194
243
 
244
+ # <!--
245
+ # rdoc-file=ext/date/date_core.c
246
+ # - Date._strptime(string[, format='%F']) -> hash
247
+ # -->
195
248
  # Parses the given representation of date and time with the given template, and
196
249
  # returns a hash of parsed elements. _strptime does not support specification
197
250
  # of flags and width unlike strftime.
@@ -203,10 +256,23 @@ class Date
203
256
  #
204
257
  def self._strptime: (String str, ?String format) -> Hash[Symbol, Integer]
205
258
 
259
+ # <!--
260
+ # rdoc-file=ext/date/date_core.c
261
+ # - Date._xmlschema(string, limit: 128) -> hash
262
+ # -->
206
263
  # Returns a hash of parsed elements.
207
264
  #
265
+ # Raise an ArgumentError when the string length is longer than *limit*. You can
266
+ # stop this check by passing `limit: nil`, but note that it may take a long time
267
+ # to parse.
268
+ #
208
269
  def self._xmlschema: (String str) -> Hash[Symbol, Integer]
209
270
 
271
+ # <!--
272
+ # rdoc-file=ext/date/date_core.c
273
+ # - Date.civil([year=-4712[, month=1[, mday=1[, start=Date::ITALY]]]]) -> date
274
+ # - Date.new([year=-4712[, month=1[, mday=1[, start=Date::ITALY]]]]) -> date
275
+ # -->
210
276
  # Creates a date object denoting the given calendar date.
211
277
  #
212
278
  # In this class, BCE years are counted astronomically. Thus, the year before
@@ -229,6 +295,10 @@ class Date
229
295
  #
230
296
  def self.civil: (?Integer year, ?Integer month, ?Integer mday, ?Integer start) -> Date
231
297
 
298
+ # <!--
299
+ # rdoc-file=ext/date/date_core.c
300
+ # - Date.commercial([cwyear=-4712[, cweek=1[, cwday=1[, start=Date::ITALY]]]]) -> date
301
+ # -->
232
302
  # Creates a date object denoting the given week date.
233
303
  #
234
304
  # The week and the day of week should be a negative or a positive number (as a
@@ -243,6 +313,11 @@ class Date
243
313
  #
244
314
  def self.commercial: (?Integer cwyear, ?Integer cweek, ?Integer cwday, ?Integer start) -> Date
245
315
 
316
+ # <!--
317
+ # rdoc-file=ext/date/date_core.c
318
+ # - Date.gregorian_leap?(year) -> bool
319
+ # - Date.leap?(year) -> bool
320
+ # -->
246
321
  # Returns true if the given year is a leap year of the proleptic Gregorian
247
322
  # calendar.
248
323
  #
@@ -251,14 +326,26 @@ class Date
251
326
  #
252
327
  def self.gregorian_leap?: (Integer year) -> bool
253
328
 
329
+ # <!--
330
+ # rdoc-file=ext/date/date_core.c
331
+ # - Date.httpdate(string='Mon, 01 Jan -4712 00:00:00 GMT'[, start=Date::ITALY], limit: 128) -> date
332
+ # -->
254
333
  # Creates a new Date object by parsing from a string according to some RFC 2616
255
334
  # format.
256
335
  #
257
336
  # Date.httpdate('Sat, 03 Feb 2001 00:00:00 GMT')
258
337
  # #=> #<Date: 2001-02-03 ...>
259
338
  #
339
+ # Raise an ArgumentError when the string length is longer than *limit*. You can
340
+ # stop this check by passing `limit: nil`, but note that it may take a long time
341
+ # to parse.
342
+ #
260
343
  def self.httpdate: (String str, ?Integer start) -> Date
261
344
 
345
+ # <!--
346
+ # rdoc-file=ext/date/date_core.c
347
+ # - Date.iso8601(string='-4712-01-01'[, start=Date::ITALY], limit: 128) -> date
348
+ # -->
262
349
  # Creates a new Date object by parsing from a string according to some typical
263
350
  # ISO 8601 formats.
264
351
  #
@@ -266,8 +353,16 @@ class Date
266
353
  # Date.iso8601('20010203') #=> #<Date: 2001-02-03 ...>
267
354
  # Date.iso8601('2001-W05-6') #=> #<Date: 2001-02-03 ...>
268
355
  #
356
+ # Raise an ArgumentError when the string length is longer than *limit*. You can
357
+ # stop this check by passing `limit: nil`, but note that it may take a long time
358
+ # to parse.
359
+ #
269
360
  def self.iso8601: (String str, ?Integer start) -> Date
270
361
 
362
+ # <!--
363
+ # rdoc-file=ext/date/date_core.c
364
+ # - Date.jd([jd=0[, start=Date::ITALY]]) -> date
365
+ # -->
271
366
  # Creates a date object denoting the given chronological Julian day number.
272
367
  #
273
368
  # Date.jd(2451944) #=> #<Date: 2001-02-03 ...>
@@ -278,6 +373,10 @@ class Date
278
373
  #
279
374
  def self.jd: (Integer jd, ?Integer start) -> Date
280
375
 
376
+ # <!--
377
+ # rdoc-file=ext/date/date_core.c
378
+ # - Date.jisx0301(string='-4712-01-01'[, start=Date::ITALY], limit: 128) -> date
379
+ # -->
281
380
  # Creates a new Date object by parsing from a string according to some typical
282
381
  # JIS X 0301 formats.
283
382
  #
@@ -287,8 +386,16 @@ class Date
287
386
  #
288
387
  # Date.jisx0301('13.02.03') #=> #<Date: 2001-02-03 ...>
289
388
  #
389
+ # Raise an ArgumentError when the string length is longer than *limit*. You can
390
+ # stop this check by passing `limit: nil`, but note that it may take a long time
391
+ # to parse.
392
+ #
290
393
  def self.jisx0301: (String str, ?Integer start) -> Date
291
394
 
395
+ # <!--
396
+ # rdoc-file=ext/date/date_core.c
397
+ # - Date.julian_leap?(year) -> bool
398
+ # -->
292
399
  # Returns true if the given year is a leap year of the proleptic Julian
293
400
  # calendar.
294
401
  #
@@ -297,6 +404,11 @@ class Date
297
404
  #
298
405
  def self.julian_leap?: (Integer year) -> bool
299
406
 
407
+ # <!--
408
+ # rdoc-file=ext/date/date_core.c
409
+ # - Date.gregorian_leap?(year) -> bool
410
+ # - Date.leap?(year) -> bool
411
+ # -->
300
412
  # Returns true if the given year is a leap year of the proleptic Gregorian
301
413
  # calendar.
302
414
  #
@@ -305,6 +417,10 @@ class Date
305
417
  #
306
418
  def self.leap?: (Integer year) -> bool
307
419
 
420
+ # <!--
421
+ # rdoc-file=ext/date/date_core.c
422
+ # - Date.ordinal([year=-4712[, yday=1[, start=Date::ITALY]]]) -> date
423
+ # -->
308
424
  # Creates a date object denoting the given ordinal date.
309
425
  #
310
426
  # The day of year should be a negative or a positive number (as a relative day
@@ -318,8 +434,15 @@ class Date
318
434
  #
319
435
  def self.ordinal: (?Integer year, ?Integer yday, ?Integer start) -> Date
320
436
 
437
+ # <!--
438
+ # rdoc-file=ext/date/date_core.c
439
+ # - Date.parse(string='-4712-01-01'[, comp=true[, start=Date::ITALY]], limit: 128) -> date
440
+ # -->
321
441
  # Parses the given representation of date and time, and creates a date object.
322
- # This method does not function as a validator.
442
+ #
443
+ # This method *does not* function as a validator. If the input string does not
444
+ # match valid formats strictly, you may get a cryptic result. Should consider
445
+ # to use `Date.strptime` instead of this method as possible.
323
446
  #
324
447
  # If the optional second argument is true and the detected year is in the range
325
448
  # "00" to "99", considers the year a 2-digit form and makes it full.
@@ -328,31 +451,65 @@ class Date
328
451
  # Date.parse('20010203') #=> #<Date: 2001-02-03 ...>
329
452
  # Date.parse('3rd Feb 2001') #=> #<Date: 2001-02-03 ...>
330
453
  #
454
+ # Raise an ArgumentError when the string length is longer than *limit*. You can
455
+ # stop this check by passing `limit: nil`, but note that it may take a long time
456
+ # to parse.
457
+ #
331
458
  def self.parse: (String str, ?boolish complete, ?Integer start) -> Date
332
459
 
460
+ # <!--
461
+ # rdoc-file=ext/date/date_core.c
462
+ # - Date.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY], limit: 128) -> date
463
+ # - Date.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY], limit: 128) -> date
464
+ # -->
333
465
  # Creates a new Date object by parsing from a string according to some typical
334
466
  # RFC 2822 formats.
335
467
  #
336
468
  # Date.rfc2822('Sat, 3 Feb 2001 00:00:00 +0000')
337
469
  # #=> #<Date: 2001-02-03 ...>
338
470
  #
471
+ # Raise an ArgumentError when the string length is longer than *limit*. You can
472
+ # stop this check by passing `limit: nil`, but note that it may take a long time
473
+ # to parse.
474
+ #
339
475
  def self.rfc2822: (String str, ?Integer start) -> Date
340
476
 
477
+ # <!--
478
+ # rdoc-file=ext/date/date_core.c
479
+ # - Date.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY], limit: 128) -> date
480
+ # -->
341
481
  # Creates a new Date object by parsing from a string according to some typical
342
482
  # RFC 3339 formats.
343
483
  #
344
484
  # Date.rfc3339('2001-02-03T04:05:06+07:00') #=> #<Date: 2001-02-03 ...>
345
485
  #
486
+ # Raise an ArgumentError when the string length is longer than *limit*. You can
487
+ # stop this check by passing `limit: nil`, but note that it may take a long time
488
+ # to parse.
489
+ #
346
490
  def self.rfc3339: (String str, ?Integer start) -> Date
347
491
 
492
+ # <!--
493
+ # rdoc-file=ext/date/date_core.c
494
+ # - Date.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY], limit: 128) -> date
495
+ # - Date.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY], limit: 128) -> date
496
+ # -->
348
497
  # Creates a new Date object by parsing from a string according to some typical
349
498
  # RFC 2822 formats.
350
499
  #
351
500
  # Date.rfc2822('Sat, 3 Feb 2001 00:00:00 +0000')
352
501
  # #=> #<Date: 2001-02-03 ...>
353
502
  #
503
+ # Raise an ArgumentError when the string length is longer than *limit*. You can
504
+ # stop this check by passing `limit: nil`, but note that it may take a long time
505
+ # to parse.
506
+ #
354
507
  def self.rfc822: (String str, ?Integer start) -> Date
355
508
 
509
+ # <!--
510
+ # rdoc-file=ext/date/date_core.c
511
+ # - Date.strptime([string='-4712-01-01'[, format='%F'[, start=Date::ITALY]]]) -> date
512
+ # -->
356
513
  # Parses the given representation of date and time with the given template, and
357
514
  # creates a date object. strptime does not support specification of flags and
358
515
  # width unlike strftime.
@@ -369,12 +526,21 @@ class Date
369
526
  #
370
527
  def self.strptime: (String str, ?String format, ?Integer start) -> Date
371
528
 
529
+ # <!--
530
+ # rdoc-file=ext/date/date_core.c
531
+ # - Date.today([start=Date::ITALY]) -> date
532
+ # -->
372
533
  # Creates a date object denoting the present day.
373
534
  #
374
535
  # Date.today #=> #<Date: 2011-06-11 ...>
375
536
  #
376
537
  def self.today: (?Integer start) -> Date
377
538
 
539
+ # <!--
540
+ # rdoc-file=ext/date/date_core.c
541
+ # - Date.valid_civil?(year, month, mday[, start=Date::ITALY]) -> bool
542
+ # - Date.valid_date?(year, month, mday[, start=Date::ITALY]) -> bool
543
+ # -->
378
544
  # Returns true if the given calendar date is valid, and false if not. Valid in
379
545
  # this context is whether the arguments passed to this method would be accepted
380
546
  # by ::new.
@@ -387,6 +553,10 @@ class Date
387
553
  #
388
554
  def self.valid_civil?: (Integer year, Integer month, Integer mday, ?Integer start) -> bool
389
555
 
556
+ # <!--
557
+ # rdoc-file=ext/date/date_core.c
558
+ # - Date.valid_commercial?(cwyear, cweek, cwday[, start=Date::ITALY]) -> bool
559
+ # -->
390
560
  # Returns true if the given week date is valid, and false if not.
391
561
  #
392
562
  # Date.valid_commercial?(2001,5,6) #=> true
@@ -396,6 +566,11 @@ class Date
396
566
  #
397
567
  def self.valid_commercial?: (Integer cwyear, Integer cweek, Integer cwday, ?Integer start) -> bool
398
568
 
569
+ # <!--
570
+ # rdoc-file=ext/date/date_core.c
571
+ # - Date.valid_civil?(year, month, mday[, start=Date::ITALY]) -> bool
572
+ # - Date.valid_date?(year, month, mday[, start=Date::ITALY]) -> bool
573
+ # -->
399
574
  # Returns true if the given calendar date is valid, and false if not. Valid in
400
575
  # this context is whether the arguments passed to this method would be accepted
401
576
  # by ::new.
@@ -408,6 +583,10 @@ class Date
408
583
  #
409
584
  def self.valid_date?: (Integer year, Integer month, Integer mday, ?Integer start) -> bool
410
585
 
586
+ # <!--
587
+ # rdoc-file=ext/date/date_core.c
588
+ # - Date.valid_jd?(jd[, start=Date::ITALY]) -> bool
589
+ # -->
411
590
  # Just returns true. It's nonsense, but is for symmetry.
412
591
  #
413
592
  # Date.valid_jd?(2451944) #=> true
@@ -416,6 +595,10 @@ class Date
416
595
  #
417
596
  def self.valid_jd?: (Integer jd, ?Integer start) -> bool
418
597
 
598
+ # <!--
599
+ # rdoc-file=ext/date/date_core.c
600
+ # - Date.valid_ordinal?(year, yday[, start=Date::ITALY]) -> bool
601
+ # -->
419
602
  # Returns true if the given ordinal date is valid, and false if not.
420
603
  #
421
604
  # Date.valid_ordinal?(2001,34) #=> true
@@ -425,15 +608,27 @@ class Date
425
608
  #
426
609
  def self.valid_ordinal?: (Integer year, Integer yday, ?Integer start) -> bool
427
610
 
611
+ # <!--
612
+ # rdoc-file=ext/date/date_core.c
613
+ # - Date.xmlschema(string='-4712-01-01'[, start=Date::ITALY], limit: 128) -> date
614
+ # -->
428
615
  # Creates a new Date object by parsing from a string according to some typical
429
616
  # XML Schema formats.
430
617
  #
431
618
  # Date.xmlschema('2001-02-03') #=> #<Date: 2001-02-03 ...>
432
619
  #
620
+ # Raise an ArgumentError when the string length is longer than *limit*. You can
621
+ # stop this check by passing `limit: nil`, but note that it may take a long time
622
+ # to parse.
623
+ #
433
624
  def self.xmlschema: (String str, ?Integer start) -> Date
434
625
 
435
626
  public
436
627
 
628
+ # <!--
629
+ # rdoc-file=ext/date/date_core.c
630
+ # - d + other -> date
631
+ # -->
437
632
  # Returns a date object pointing `other` days after self. The other should be a
438
633
  # numeric value. If the other is a fractional number, assumes its precision is
439
634
  # at most nanosecond.
@@ -446,8 +641,12 @@ class Date
446
641
  # DateTime.jd(0,12) + DateTime.new(2001,2,3).ajd
447
642
  # #=> #<DateTime: 2001-02-03T00:00:00+00:00 ...>
448
643
  #
449
- def +: ((Numeric & _ToR) other) -> Date
644
+ def +: (Numeric & _ToR other) -> Date
450
645
 
646
+ # <!--
647
+ # rdoc-file=ext/date/date_core.c
648
+ # - d - other -> date or rational
649
+ # -->
451
650
  # Returns the difference between the two dates if the other is a date object.
452
651
  # If the other is a numeric value, returns a date object pointing `other` days
453
652
  # before self. If the other is a fractional number, assumes its precision is at
@@ -461,9 +660,13 @@ class Date
461
660
  # DateTime.new(2001,2,3) - DateTime.new(2001,2,2,12)
462
661
  # #=> (1/2)
463
662
  #
464
- def -: ((Numeric & _ToR) other) -> Date
663
+ def -: (Numeric & _ToR other) -> Date
465
664
  | (Date other) -> Rational
466
665
 
666
+ # <!--
667
+ # rdoc-file=ext/date/date_core.c
668
+ # - d << n -> date
669
+ # -->
467
670
  # Returns a date object pointing `n` months before self. The argument `n` should
468
671
  # be a numeric value.
469
672
  #
@@ -485,6 +688,10 @@ class Date
485
688
  #
486
689
  def <<: (Integer month) -> Date
487
690
 
691
+ # <!--
692
+ # rdoc-file=ext/date/date_core.c
693
+ # - d <=> other -> -1, 0, +1 or nil
694
+ # -->
488
695
  # Compares the two dates and returns -1, zero, 1 or nil. The other should be a
489
696
  # date object or a numeric value as an astronomical Julian day number.
490
697
  #
@@ -498,6 +705,10 @@ class Date
498
705
  #
499
706
  def <=>: (untyped other) -> Integer?
500
707
 
708
+ # <!--
709
+ # rdoc-file=ext/date/date_core.c
710
+ # - d === other -> bool
711
+ # -->
501
712
  # Returns true if they are the same day.
502
713
  #
503
714
  # Date.new(2001,2,3) === Date.new(2001,2,3)
@@ -513,6 +724,10 @@ class Date
513
724
  #
514
725
  def ===: (Date other) -> bool
515
726
 
727
+ # <!--
728
+ # rdoc-file=ext/date/date_core.c
729
+ # - d >> n -> date
730
+ # -->
516
731
  # Returns a date object pointing `n` months after self. The argument `n` should
517
732
  # be a numeric value.
518
733
  #
@@ -534,6 +749,10 @@ class Date
534
749
  #
535
750
  def >>: (Integer month) -> Date
536
751
 
752
+ # <!--
753
+ # rdoc-file=ext/date/date_core.c
754
+ # - d.ajd -> rational
755
+ # -->
537
756
  # Returns the astronomical Julian day number. This is a fractional number,
538
757
  # which is not adjusted by the offset.
539
758
  #
@@ -542,6 +761,10 @@ class Date
542
761
  #
543
762
  def ajd: () -> Rational
544
763
 
764
+ # <!--
765
+ # rdoc-file=ext/date/date_core.c
766
+ # - d.amjd -> rational
767
+ # -->
545
768
  # Returns the astronomical modified Julian day number. This is a fractional
546
769
  # number, which is not adjusted by the offset.
547
770
  #
@@ -550,6 +773,11 @@ class Date
550
773
  #
551
774
  def amjd: () -> Rational
552
775
 
776
+ # <!--
777
+ # rdoc-file=ext/date/date_core.c
778
+ # - d.asctime -> string
779
+ # - d.ctime -> string
780
+ # -->
553
781
  # Returns a string in asctime(3) format (but without "n\0" at the end). This
554
782
  # method is equivalent to strftime('%c').
555
783
  #
@@ -557,6 +785,7 @@ class Date
557
785
  #
558
786
  def asctime: () -> String
559
787
 
788
+ # <!-- rdoc-file=ext/date/date_core.c -->
560
789
  # Returns a string in asctime(3) format (but without "n\0" at the end). This
561
790
  # method is equivalent to strftime('%c').
562
791
  #
@@ -564,18 +793,30 @@ class Date
564
793
  #
565
794
  def ctime: () -> String
566
795
 
796
+ # <!--
797
+ # rdoc-file=ext/date/date_core.c
798
+ # - d.cwday -> fixnum
799
+ # -->
567
800
  # Returns the day of calendar week (1-7, Monday is 1).
568
801
  #
569
802
  # Date.new(2001,2,3).cwday #=> 6
570
803
  #
571
804
  def cwday: () -> Integer
572
805
 
806
+ # <!--
807
+ # rdoc-file=ext/date/date_core.c
808
+ # - d.cweek -> fixnum
809
+ # -->
573
810
  # Returns the calendar week number (1-53).
574
811
  #
575
812
  # Date.new(2001,2,3).cweek #=> 5
576
813
  #
577
814
  def cweek: () -> Integer
578
815
 
816
+ # <!--
817
+ # rdoc-file=ext/date/date_core.c
818
+ # - d.cwyear -> integer
819
+ # -->
579
820
  # Returns the calendar week based year.
580
821
  #
581
822
  # Date.new(2001,2,3).cwyear #=> 2001
@@ -583,29 +824,51 @@ class Date
583
824
  #
584
825
  def cwyear: () -> Integer
585
826
 
827
+ # <!-- rdoc-file=ext/date/date_core.c -->
586
828
  # Returns the day of the month (1-31).
587
829
  #
588
830
  # Date.new(2001,2,3).mday #=> 3
589
831
  #
590
832
  def day: () -> Integer
591
833
 
834
+ # <!--
835
+ # rdoc-file=ext/date/date_core.c
836
+ # - d.downto(min) -> enumerator
837
+ # - d.downto(min){|date| ...} -> self
838
+ # -->
592
839
  # This method is equivalent to step(min, -1){|date| ...}.
593
840
  #
594
841
  def downto: (Date min) { (Date) -> untyped } -> Date
595
842
  | (Date min) -> Enumerator[Date, Date]
596
843
 
844
+ # <!--
845
+ # rdoc-file=ext/date/date_core.c
846
+ # - d.england -> date
847
+ # -->
597
848
  # This method is equivalent to new_start(Date::ENGLAND).
598
849
  #
599
850
  def england: () -> Date
600
851
 
852
+ # <!--
853
+ # rdoc-file=ext/date/date_core.c
854
+ # - d.friday? -> bool
855
+ # -->
601
856
  # Returns true if the date is Friday.
602
857
  #
603
858
  def friday?: () -> bool
604
859
 
860
+ # <!--
861
+ # rdoc-file=ext/date/date_core.c
862
+ # - d.gregorian -> date
863
+ # -->
605
864
  # This method is equivalent to new_start(Date::GREGORIAN).
606
865
  #
607
866
  def gregorian: () -> Date
608
867
 
868
+ # <!--
869
+ # rdoc-file=ext/date/date_core.c
870
+ # - d.gregorian? -> bool
871
+ # -->
609
872
  # Returns true if the date is on or after the day of calendar reform.
610
873
  #
611
874
  # Date.new(1582,10,15).gregorian? #=> true
@@ -613,11 +876,19 @@ class Date
613
876
  #
614
877
  def gregorian?: () -> bool
615
878
 
879
+ # <!--
880
+ # rdoc-file=ext/date/date_core.c
881
+ # - d.httpdate -> string
882
+ # -->
616
883
  # This method is equivalent to strftime('%a, %d %b %Y %T GMT'). See also RFC
617
884
  # 2616.
618
885
  #
619
886
  def httpdate: () -> String
620
887
 
888
+ # <!--
889
+ # rdoc-file=ext/date/date_core.c
890
+ # - d.inspect -> string
891
+ # -->
621
892
  # Returns the value as a string for inspection.
622
893
  #
623
894
  # Date.new(2001,2,3).inspect
@@ -627,14 +898,27 @@ class Date
627
898
  #
628
899
  def inspect: () -> String
629
900
 
901
+ # <!--
902
+ # rdoc-file=ext/date/date_core.c
903
+ # - d.iso8601 -> string
904
+ # - d.xmlschema -> string
905
+ # -->
630
906
  # This method is equivalent to strftime('%F').
631
907
  #
632
908
  def iso8601: () -> String
633
909
 
910
+ # <!--
911
+ # rdoc-file=ext/date/date_core.c
912
+ # - d.italy -> date
913
+ # -->
634
914
  # This method is equivalent to new_start(Date::ITALY).
635
915
  #
636
916
  def italy: () -> Date
637
917
 
918
+ # <!--
919
+ # rdoc-file=ext/date/date_core.c
920
+ # - d.jd -> integer
921
+ # -->
638
922
  # Returns the Julian day number. This is a whole number, which is adjusted by
639
923
  # the offset as the local time.
640
924
  #
@@ -643,16 +927,28 @@ class Date
643
927
  #
644
928
  def jd: () -> Integer
645
929
 
930
+ # <!--
931
+ # rdoc-file=ext/date/date_core.c
932
+ # - d.jisx0301 -> string
933
+ # -->
646
934
  # Returns a string in a JIS X 0301 format.
647
935
  #
648
936
  # Date.new(2001,2,3).jisx0301 #=> "H13.02.03"
649
937
  #
650
938
  def jisx0301: () -> String
651
939
 
940
+ # <!--
941
+ # rdoc-file=ext/date/date_core.c
942
+ # - d.julian -> date
943
+ # -->
652
944
  # This method is equivalent to new_start(Date::JULIAN).
653
945
  #
654
946
  def julian: () -> Date
655
947
 
948
+ # <!--
949
+ # rdoc-file=ext/date/date_core.c
950
+ # - d.julian? -> bool
951
+ # -->
656
952
  # Returns true if the date is before the day of calendar reform.
657
953
  #
658
954
  # Date.new(1582,10,15).julian? #=> false
@@ -660,6 +956,10 @@ class Date
660
956
  #
661
957
  def julian?: () -> bool
662
958
 
959
+ # <!--
960
+ # rdoc-file=ext/date/date_core.c
961
+ # - d.ld -> integer
962
+ # -->
663
963
  # Returns the Lilian day number. This is a whole number, which is adjusted by
664
964
  # the offset as the local time.
665
965
  #
@@ -667,6 +967,10 @@ class Date
667
967
  #
668
968
  def ld: () -> Integer
669
969
 
970
+ # <!--
971
+ # rdoc-file=ext/date/date_core.c
972
+ # - d.leap? -> bool
973
+ # -->
670
974
  # Returns true if the year is a leap year.
671
975
  #
672
976
  # Date.new(2000).leap? #=> true
@@ -674,12 +978,21 @@ class Date
674
978
  #
675
979
  def leap?: () -> bool
676
980
 
981
+ # <!--
982
+ # rdoc-file=ext/date/date_core.c
983
+ # - d.mday -> fixnum
984
+ # - d.day -> fixnum
985
+ # -->
677
986
  # Returns the day of the month (1-31).
678
987
  #
679
988
  # Date.new(2001,2,3).mday #=> 3
680
989
  #
681
990
  def mday: () -> Integer
682
991
 
992
+ # <!--
993
+ # rdoc-file=ext/date/date_core.c
994
+ # - d.mjd -> integer
995
+ # -->
683
996
  # Returns the modified Julian day number. This is a whole number, which is
684
997
  # adjusted by the offset as the local time.
685
998
  #
@@ -688,22 +1001,36 @@ class Date
688
1001
  #
689
1002
  def mjd: () -> Integer
690
1003
 
1004
+ # <!--
1005
+ # rdoc-file=ext/date/date_core.c
1006
+ # - d.mon -> fixnum
1007
+ # - d.month -> fixnum
1008
+ # -->
691
1009
  # Returns the month (1-12).
692
1010
  #
693
1011
  # Date.new(2001,2,3).mon #=> 2
694
1012
  #
695
1013
  def mon: () -> Integer
696
1014
 
1015
+ # <!--
1016
+ # rdoc-file=ext/date/date_core.c
1017
+ # - d.monday? -> bool
1018
+ # -->
697
1019
  # Returns true if the date is Monday.
698
1020
  #
699
1021
  def monday?: () -> bool
700
1022
 
1023
+ # <!-- rdoc-file=ext/date/date_core.c -->
701
1024
  # Returns the month (1-12).
702
1025
  #
703
1026
  # Date.new(2001,2,3).mon #=> 2
704
1027
  #
705
1028
  def month: () -> Integer
706
1029
 
1030
+ # <!--
1031
+ # rdoc-file=ext/date/date_core.c
1032
+ # - d.new_start([start=Date::ITALY]) -> date
1033
+ # -->
707
1034
  # Duplicates self and resets its day of calendar reform.
708
1035
  #
709
1036
  # d = Date.new(1582,10,15)
@@ -711,58 +1038,121 @@ class Date
711
1038
  #
712
1039
  def new_start: (?Integer start) -> Date
713
1040
 
1041
+ # <!--
1042
+ # rdoc-file=ext/date/date_core.c
1043
+ # - d.succ -> date
1044
+ # - d.next -> date
1045
+ # -->
714
1046
  # Returns a date object denoting the following day.
715
1047
  #
716
1048
  def next: () -> Date
717
1049
 
1050
+ # <!--
1051
+ # rdoc-file=ext/date/date_core.c
1052
+ # - d.next_day([n=1]) -> date
1053
+ # -->
718
1054
  # This method is equivalent to d + n.
719
1055
  #
720
1056
  def next_day: (?Integer day) -> Date
721
1057
 
1058
+ # <!--
1059
+ # rdoc-file=ext/date/date_core.c
1060
+ # - d.next_month([n=1]) -> date
1061
+ # -->
722
1062
  # This method is equivalent to d >> n.
723
1063
  #
1064
+ # See Date#>> for examples.
1065
+ #
724
1066
  def next_month: (?Integer month) -> Date
725
1067
 
1068
+ # <!--
1069
+ # rdoc-file=ext/date/date_core.c
1070
+ # - d.next_year([n=1]) -> date
1071
+ # -->
726
1072
  # This method is equivalent to d >> (n * 12).
727
1073
  #
728
1074
  # Date.new(2001,2,3).next_year #=> #<Date: 2002-02-03 ...>
729
1075
  # Date.new(2008,2,29).next_year #=> #<Date: 2009-02-28 ...>
730
1076
  # Date.new(2008,2,29).next_year(4) #=> #<Date: 2012-02-29 ...>
731
1077
  #
1078
+ # See also Date#>>.
1079
+ #
732
1080
  def next_year: (?Integer year) -> Date
733
1081
 
1082
+ # <!--
1083
+ # rdoc-file=ext/date/date_core.c
1084
+ # - d.prev_day([n=1]) -> date
1085
+ # -->
734
1086
  # This method is equivalent to d - n.
735
1087
  #
736
1088
  def prev_day: (?Integer day) -> Date
737
1089
 
1090
+ # <!--
1091
+ # rdoc-file=ext/date/date_core.c
1092
+ # - d.prev_month([n=1]) -> date
1093
+ # -->
738
1094
  # This method is equivalent to d << n.
739
1095
  #
1096
+ # See Date#<< for examples.
1097
+ #
740
1098
  def prev_month: (?Integer month) -> Date
741
1099
 
1100
+ # <!--
1101
+ # rdoc-file=ext/date/date_core.c
1102
+ # - d.prev_year([n=1]) -> date
1103
+ # -->
742
1104
  # This method is equivalent to d << (n * 12).
743
1105
  #
744
1106
  # Date.new(2001,2,3).prev_year #=> #<Date: 2000-02-03 ...>
745
1107
  # Date.new(2008,2,29).prev_year #=> #<Date: 2007-02-28 ...>
746
1108
  # Date.new(2008,2,29).prev_year(4) #=> #<Date: 2004-02-29 ...>
747
1109
  #
1110
+ # See also Date#<<.
1111
+ #
748
1112
  def prev_year: (?Integer year) -> Date
749
1113
 
1114
+ # <!--
1115
+ # rdoc-file=ext/date/date_core.c
1116
+ # - d.rfc2822 -> string
1117
+ # - d.rfc822 -> string
1118
+ # -->
750
1119
  # This method is equivalent to strftime('%a, %-d %b %Y %T %z').
751
1120
  #
752
1121
  def rfc2822: () -> String
753
1122
 
1123
+ # <!--
1124
+ # rdoc-file=ext/date/date_core.c
1125
+ # - d.rfc3339 -> string
1126
+ # -->
754
1127
  # This method is equivalent to strftime('%FT%T%:z').
755
1128
  #
756
1129
  def rfc3339: () -> String
757
1130
 
758
- # This method is equivalent to strftime('%a, %-d %b %Y %T %z').
1131
+ # <!-- rdoc-file=ext/date/date_core.c -->
1132
+ # Creates a new Date object by parsing from a string according to some typical
1133
+ # RFC 2822 formats.
1134
+ #
1135
+ # Date.rfc2822('Sat, 3 Feb 2001 00:00:00 +0000')
1136
+ # #=> #<Date: 2001-02-03 ...>
1137
+ #
1138
+ # Raise an ArgumentError when the string length is longer than *limit*. You can
1139
+ # stop this check by passing `limit: nil`, but note that it may take a long time
1140
+ # to parse.
759
1141
  #
760
1142
  def rfc822: () -> String
761
1143
 
1144
+ # <!--
1145
+ # rdoc-file=ext/date/date_core.c
1146
+ # - d.saturday? -> bool
1147
+ # -->
762
1148
  # Returns true if the date is Saturday.
763
1149
  #
764
1150
  def saturday?: () -> bool
765
1151
 
1152
+ # <!--
1153
+ # rdoc-file=ext/date/date_core.c
1154
+ # - d.start -> float
1155
+ # -->
766
1156
  # Returns the Julian day number denoting the day of calendar reform.
767
1157
  #
768
1158
  # Date.new(2001,2,3).start #=> 2299161.0
@@ -770,6 +1160,11 @@ class Date
770
1160
  #
771
1161
  def start: () -> Float
772
1162
 
1163
+ # <!--
1164
+ # rdoc-file=ext/date/date_core.c
1165
+ # - d.step(limit[, step=1]) -> enumerator
1166
+ # - d.step(limit[, step=1]){|date| ...} -> self
1167
+ # -->
773
1168
  # Iterates evaluation of the given block, which takes a date object. The limit
774
1169
  # should be a date object.
775
1170
  #
@@ -779,6 +1174,10 @@ class Date
779
1174
  def step: (Date limit, ?Integer step) { (Date) -> untyped } -> Date
780
1175
  | (Date limit, ?Integer step) -> ::Enumerator[Date, Date]
781
1176
 
1177
+ # <!--
1178
+ # rdoc-file=ext/date/date_core.c
1179
+ # - d.strftime([format='%F']) -> string
1180
+ # -->
782
1181
  # Formats date according to the directives in the given format string. The
783
1182
  # directives begin with a percent (%) character. Any text not listed as a
784
1183
  # directive will be passed through to the output string.
@@ -886,7 +1285,7 @@ class Date
886
1285
  # %c - date and time (%a %b %e %T %Y)
887
1286
  # %D - Date (%m/%d/%y)
888
1287
  # %F - The ISO 8601 date format (%Y-%m-%d)
889
- # %v - VMS date (%e-%b-%Y)
1288
+ # %v - VMS date (%e-%^b-%Y)
890
1289
  # %x - Same as %D
891
1290
  # %X - Same as %T
892
1291
  # %r - 12-hour time (%I:%M:%S %p)
@@ -948,26 +1347,47 @@ class Date
948
1347
  #
949
1348
  def strftime: (?String format) -> String
950
1349
 
1350
+ # <!-- rdoc-file=ext/date/date_core.c -->
951
1351
  # Returns a date object denoting the following day.
952
1352
  #
953
1353
  def succ: () -> Date
954
1354
 
1355
+ # <!--
1356
+ # rdoc-file=ext/date/date_core.c
1357
+ # - d.sunday? -> bool
1358
+ # -->
955
1359
  # Returns true if the date is Sunday.
956
1360
  #
957
1361
  def sunday?: () -> bool
958
1362
 
1363
+ # <!--
1364
+ # rdoc-file=ext/date/date_core.c
1365
+ # - d.thursday? -> bool
1366
+ # -->
959
1367
  # Returns true if the date is Thursday.
960
1368
  #
961
1369
  def thursday?: () -> bool
962
1370
 
1371
+ # <!--
1372
+ # rdoc-file=ext/date/date_core.c
1373
+ # - d.to_date -> self
1374
+ # -->
963
1375
  # Returns self.
964
1376
  #
965
1377
  def to_date: () -> Date
966
1378
 
1379
+ # <!--
1380
+ # rdoc-file=ext/date/date_core.c
1381
+ # - d.to_datetime -> datetime
1382
+ # -->
967
1383
  # Returns a DateTime object which denotes self.
968
1384
  #
969
1385
  def to_datetime: () -> DateTime
970
1386
 
1387
+ # <!--
1388
+ # rdoc-file=ext/date/date_core.c
1389
+ # - d.to_s -> string
1390
+ # -->
971
1391
  # Returns a string in an ISO 8601 format. (This method doesn't use the expanded
972
1392
  # representations.)
973
1393
  #
@@ -975,40 +1395,70 @@ class Date
975
1395
  #
976
1396
  def to_s: () -> String
977
1397
 
1398
+ # <!--
1399
+ # rdoc-file=ext/date/date_core.c
1400
+ # - d.to_time -> time
1401
+ # -->
978
1402
  # Returns a Time object which denotes self. If self is a julian date, convert it
979
1403
  # to a gregorian date before converting it to Time.
980
1404
  #
981
1405
  def to_time: () -> Time
982
1406
 
1407
+ # <!--
1408
+ # rdoc-file=ext/date/date_core.c
1409
+ # - d.tuesday? -> bool
1410
+ # -->
983
1411
  # Returns true if the date is Tuesday.
984
1412
  #
985
1413
  def tuesday?: () -> bool
986
1414
 
1415
+ # <!--
1416
+ # rdoc-file=ext/date/date_core.c
1417
+ # - d.upto(max) -> enumerator
1418
+ # - d.upto(max){|date| ...} -> self
1419
+ # -->
987
1420
  # This method is equivalent to step(max, 1){|date| ...}.
988
1421
  #
989
1422
  def upto: (Date max) { (Date) -> untyped } -> Date
990
1423
  | (Date max) -> ::Enumerator[Date, Date]
991
1424
 
1425
+ # <!--
1426
+ # rdoc-file=ext/date/date_core.c
1427
+ # - d.wday -> fixnum
1428
+ # -->
992
1429
  # Returns the day of week (0-6, Sunday is zero).
993
1430
  #
994
1431
  # Date.new(2001,2,3).wday #=> 6
995
1432
  #
996
1433
  def wday: () -> Integer
997
1434
 
1435
+ # <!--
1436
+ # rdoc-file=ext/date/date_core.c
1437
+ # - d.wednesday? -> bool
1438
+ # -->
998
1439
  # Returns true if the date is Wednesday.
999
1440
  #
1000
1441
  def wednesday?: () -> bool
1001
1442
 
1443
+ # <!-- rdoc-file=ext/date/date_core.c -->
1002
1444
  # This method is equivalent to strftime('%F').
1003
1445
  #
1004
1446
  def xmlschema: () -> String
1005
1447
 
1448
+ # <!--
1449
+ # rdoc-file=ext/date/date_core.c
1450
+ # - d.yday -> fixnum
1451
+ # -->
1006
1452
  # Returns the day of the year (1-366).
1007
1453
  #
1008
1454
  # Date.new(2001,2,3).yday #=> 34
1009
1455
  #
1010
1456
  def yday: () -> Integer
1011
1457
 
1458
+ # <!--
1459
+ # rdoc-file=ext/date/date_core.c
1460
+ # - d.year -> integer
1461
+ # -->
1012
1462
  # Returns the year.
1013
1463
  #
1014
1464
  # Date.new(2001,2,3).year #=> 2001
@@ -1017,40 +1467,48 @@ class Date
1017
1467
  def year: () -> Integer
1018
1468
  end
1019
1469
 
1470
+ # <!-- rdoc-file=ext/date/date_core.c -->
1020
1471
  # An array of strings of abbreviated day names in English. The first is "Sun".
1021
1472
  #
1022
1473
  Date::ABBR_DAYNAMES: Array[String]
1023
1474
 
1475
+ # <!-- rdoc-file=ext/date/date_core.c -->
1024
1476
  # An array of strings of abbreviated month names in English. The first element
1025
1477
  # is nil.
1026
1478
  #
1027
1479
  Date::ABBR_MONTHNAMES: Array[String?]
1028
1480
 
1481
+ # <!-- rdoc-file=ext/date/date_core.c -->
1029
1482
  # An array of strings of the full names of days of the week in English. The
1030
1483
  # first is "Sunday".
1031
1484
  #
1032
1485
  Date::DAYNAMES: Array[String]
1033
1486
 
1487
+ # <!-- rdoc-file=ext/date/date_core.c -->
1034
1488
  # The Julian day number of the day of calendar reform for England and her
1035
1489
  # colonies.
1036
1490
  #
1037
1491
  Date::ENGLAND: Integer
1038
1492
 
1493
+ # <!-- rdoc-file=ext/date/date_core.c -->
1039
1494
  # The Julian day number of the day of calendar reform for the proleptic
1040
1495
  # Gregorian calendar.
1041
1496
  #
1042
1497
  Date::GREGORIAN: Integer
1043
1498
 
1499
+ # <!-- rdoc-file=ext/date/date_core.c -->
1044
1500
  # The Julian day number of the day of calendar reform for Italy and some
1045
1501
  # catholic countries.
1046
1502
  #
1047
1503
  Date::ITALY: Integer
1048
1504
 
1505
+ # <!-- rdoc-file=ext/date/date_core.c -->
1049
1506
  # The Julian day number of the day of calendar reform for the proleptic Julian
1050
1507
  # calendar.
1051
1508
  #
1052
1509
  Date::JULIAN: Integer
1053
1510
 
1511
+ # <!-- rdoc-file=ext/date/date_core.c -->
1054
1512
  # An array of strings of full month names in English. The first element is nil.
1055
1513
  #
1056
1514
  Date::MONTHNAMES: Array[String?]