rbs 4.1.0.pre.2-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (574) hide show
  1. checksums.yaml +7 -0
  2. data/.clang-format +75 -0
  3. data/.clangd +2 -0
  4. data/.github/dependabot.yml +24 -0
  5. data/.github/workflows/bundle-update.yml +63 -0
  6. data/.github/workflows/c-check.yml +61 -0
  7. data/.github/workflows/comments.yml +37 -0
  8. data/.github/workflows/dependabot.yml +30 -0
  9. data/.github/workflows/jruby.yml +67 -0
  10. data/.github/workflows/milestone.yml +83 -0
  11. data/.github/workflows/ruby.yml +158 -0
  12. data/.github/workflows/rust.yml +184 -0
  13. data/.github/workflows/truffleruby.yml +54 -0
  14. data/.github/workflows/typecheck.yml +39 -0
  15. data/.github/workflows/wasm.yml +53 -0
  16. data/.github/workflows/windows.yml +49 -0
  17. data/.gitignore +38 -0
  18. data/.rubocop.yml +72 -0
  19. data/BSDL +22 -0
  20. data/CHANGELOG.md +2292 -0
  21. data/COPYING +56 -0
  22. data/README.md +240 -0
  23. data/Rakefile +869 -0
  24. data/Steepfile +53 -0
  25. data/config.yml +913 -0
  26. data/core/array.rbs +4142 -0
  27. data/core/basic_object.rbs +376 -0
  28. data/core/binding.rbs +148 -0
  29. data/core/builtin.rbs +278 -0
  30. data/core/class.rbs +223 -0
  31. data/core/comparable.rbs +192 -0
  32. data/core/complex.rbs +812 -0
  33. data/core/constants.rbs +96 -0
  34. data/core/data.rbs +415 -0
  35. data/core/dir.rbs +993 -0
  36. data/core/encoding.rbs +1368 -0
  37. data/core/enumerable.rbs +2506 -0
  38. data/core/enumerator/arithmetic_sequence.rbs +70 -0
  39. data/core/enumerator/product.rbs +92 -0
  40. data/core/enumerator.rbs +705 -0
  41. data/core/env.rbs +6 -0
  42. data/core/errno.rbs +682 -0
  43. data/core/errors.rbs +789 -0
  44. data/core/exception.rbs +485 -0
  45. data/core/false_class.rbs +82 -0
  46. data/core/fiber.rbs +570 -0
  47. data/core/fiber_error.rbs +11 -0
  48. data/core/file.rbs +2045 -0
  49. data/core/file_constants.rbs +463 -0
  50. data/core/file_stat.rbs +534 -0
  51. data/core/file_test.rbs +331 -0
  52. data/core/float.rbs +1316 -0
  53. data/core/gc.rbs +788 -0
  54. data/core/global_variables.rbs +184 -0
  55. data/core/hash.rbs +2183 -0
  56. data/core/integer.rbs +1374 -0
  57. data/core/io/buffer.rbs +995 -0
  58. data/core/io/wait.rbs +48 -0
  59. data/core/io.rbs +3472 -0
  60. data/core/kernel.rbs +3172 -0
  61. data/core/marshal.rbs +207 -0
  62. data/core/match_data.rbs +637 -0
  63. data/core/math.rbs +770 -0
  64. data/core/method.rbs +422 -0
  65. data/core/module.rbs +1856 -0
  66. data/core/nil_class.rbs +210 -0
  67. data/core/numeric.rbs +832 -0
  68. data/core/object.rbs +108 -0
  69. data/core/object_space/weak_key_map.rbs +166 -0
  70. data/core/object_space.rbs +197 -0
  71. data/core/pathname.rbs +1322 -0
  72. data/core/proc.rbs +905 -0
  73. data/core/process.rbs +2316 -0
  74. data/core/ractor.rbs +924 -0
  75. data/core/random.rbs +255 -0
  76. data/core/range.rbs +1209 -0
  77. data/core/rational.rbs +502 -0
  78. data/core/rb_config.rbs +88 -0
  79. data/core/rbs/ops.rbs +154 -0
  80. data/core/rbs/unnamed/argf.rbs +1236 -0
  81. data/core/rbs/unnamed/env_class.rbs +1214 -0
  82. data/core/rbs/unnamed/main_class.rbs +123 -0
  83. data/core/rbs/unnamed/random.rbs +186 -0
  84. data/core/refinement.rbs +59 -0
  85. data/core/regexp.rbs +1974 -0
  86. data/core/ruby.rbs +53 -0
  87. data/core/ruby_vm.rbs +809 -0
  88. data/core/rubygems/basic_specification.rbs +6 -0
  89. data/core/rubygems/config_file.rbs +38 -0
  90. data/core/rubygems/dependency_installer.rbs +6 -0
  91. data/core/rubygems/errors.rbs +109 -0
  92. data/core/rubygems/installer.rbs +15 -0
  93. data/core/rubygems/path_support.rbs +6 -0
  94. data/core/rubygems/platform.rbs +7 -0
  95. data/core/rubygems/request_set.rbs +49 -0
  96. data/core/rubygems/requirement.rbs +148 -0
  97. data/core/rubygems/rubygems.rbs +1105 -0
  98. data/core/rubygems/source_list.rbs +15 -0
  99. data/core/rubygems/specification.rbs +23 -0
  100. data/core/rubygems/stream_ui.rbs +5 -0
  101. data/core/rubygems/uninstaller.rbs +10 -0
  102. data/core/rubygems/version.rbs +293 -0
  103. data/core/set.rbs +751 -0
  104. data/core/signal.rbs +110 -0
  105. data/core/string.rbs +5532 -0
  106. data/core/struct.rbs +668 -0
  107. data/core/symbol.rbs +482 -0
  108. data/core/thread.rbs +1826 -0
  109. data/core/thread_group.rbs +79 -0
  110. data/core/time.rbs +1793 -0
  111. data/core/trace_point.rbs +483 -0
  112. data/core/true_class.rbs +98 -0
  113. data/core/unbound_method.rbs +337 -0
  114. data/core/warning.rbs +87 -0
  115. data/docs/CONTRIBUTING.md +107 -0
  116. data/docs/aliases.md +79 -0
  117. data/docs/architecture.md +110 -0
  118. data/docs/collection.md +192 -0
  119. data/docs/config.md +171 -0
  120. data/docs/data_and_struct.md +86 -0
  121. data/docs/encoding.md +56 -0
  122. data/docs/gem.md +56 -0
  123. data/docs/inline.md +634 -0
  124. data/docs/rbs_by_example.md +309 -0
  125. data/docs/repo.md +125 -0
  126. data/docs/rust.md +96 -0
  127. data/docs/sigs.md +167 -0
  128. data/docs/stdlib.md +147 -0
  129. data/docs/syntax.md +940 -0
  130. data/docs/tools.md +17 -0
  131. data/docs/type_fingerprint.md +21 -0
  132. data/docs/wasm_serialization.md +80 -0
  133. data/exe/rbs +7 -0
  134. data/ext/rbs_extension/ast_translation.c +1855 -0
  135. data/ext/rbs_extension/ast_translation.h +41 -0
  136. data/ext/rbs_extension/class_constants.c +187 -0
  137. data/ext/rbs_extension/class_constants.h +104 -0
  138. data/ext/rbs_extension/compat.h +10 -0
  139. data/ext/rbs_extension/extconf.rb +40 -0
  140. data/ext/rbs_extension/legacy_location.c +294 -0
  141. data/ext/rbs_extension/legacy_location.h +82 -0
  142. data/ext/rbs_extension/main.c +613 -0
  143. data/ext/rbs_extension/rbs_extension.h +16 -0
  144. data/ext/rbs_extension/rbs_string_bridging.c +9 -0
  145. data/ext/rbs_extension/rbs_string_bridging.h +24 -0
  146. data/goodcheck.yml +91 -0
  147. data/include/rbs/ast.h +1047 -0
  148. data/include/rbs/defines.h +99 -0
  149. data/include/rbs/lexer.h +207 -0
  150. data/include/rbs/location.h +40 -0
  151. data/include/rbs/parser.h +153 -0
  152. data/include/rbs/serialize.h +39 -0
  153. data/include/rbs/string.h +47 -0
  154. data/include/rbs/util/rbs_allocator.h +59 -0
  155. data/include/rbs/util/rbs_assert.h +20 -0
  156. data/include/rbs/util/rbs_buffer.h +83 -0
  157. data/include/rbs/util/rbs_constant_pool.h +155 -0
  158. data/include/rbs/util/rbs_encoding.h +282 -0
  159. data/include/rbs/util/rbs_unescape.h +24 -0
  160. data/include/rbs.h +14 -0
  161. data/lib/rbs/ancestor_graph.rb +92 -0
  162. data/lib/rbs/annotate/annotations.rb +199 -0
  163. data/lib/rbs/annotate/formatter.rb +82 -0
  164. data/lib/rbs/annotate/rdoc_annotator.rb +398 -0
  165. data/lib/rbs/annotate/rdoc_source.rb +131 -0
  166. data/lib/rbs/annotate.rb +8 -0
  167. data/lib/rbs/ast/annotation.rb +29 -0
  168. data/lib/rbs/ast/comment.rb +29 -0
  169. data/lib/rbs/ast/declarations.rb +472 -0
  170. data/lib/rbs/ast/directives.rb +49 -0
  171. data/lib/rbs/ast/members.rb +451 -0
  172. data/lib/rbs/ast/ruby/annotations.rb +451 -0
  173. data/lib/rbs/ast/ruby/comment_block.rb +247 -0
  174. data/lib/rbs/ast/ruby/declarations.rb +291 -0
  175. data/lib/rbs/ast/ruby/helpers/constant_helper.rb +28 -0
  176. data/lib/rbs/ast/ruby/helpers/location_helper.rb +15 -0
  177. data/lib/rbs/ast/ruby/members.rb +762 -0
  178. data/lib/rbs/ast/type_param.rb +235 -0
  179. data/lib/rbs/ast/visitor.rb +137 -0
  180. data/lib/rbs/buffer.rb +189 -0
  181. data/lib/rbs/builtin_names.rb +58 -0
  182. data/lib/rbs/cli/colored_io.rb +48 -0
  183. data/lib/rbs/cli/diff.rb +84 -0
  184. data/lib/rbs/cli/validate.rb +294 -0
  185. data/lib/rbs/cli.rb +1253 -0
  186. data/lib/rbs/collection/cleaner.rb +38 -0
  187. data/lib/rbs/collection/config/lockfile.rb +92 -0
  188. data/lib/rbs/collection/config/lockfile_generator.rb +269 -0
  189. data/lib/rbs/collection/config.rb +81 -0
  190. data/lib/rbs/collection/installer.rb +32 -0
  191. data/lib/rbs/collection/sources/base.rb +14 -0
  192. data/lib/rbs/collection/sources/git.rb +265 -0
  193. data/lib/rbs/collection/sources/local.rb +81 -0
  194. data/lib/rbs/collection/sources/rubygems.rb +48 -0
  195. data/lib/rbs/collection/sources/stdlib.rb +50 -0
  196. data/lib/rbs/collection/sources.rb +38 -0
  197. data/lib/rbs/collection.rb +16 -0
  198. data/lib/rbs/constant.rb +28 -0
  199. data/lib/rbs/definition.rb +415 -0
  200. data/lib/rbs/definition_builder/ancestor_builder.rb +678 -0
  201. data/lib/rbs/definition_builder/method_builder.rb +295 -0
  202. data/lib/rbs/definition_builder.rb +1054 -0
  203. data/lib/rbs/diff.rb +131 -0
  204. data/lib/rbs/environment/class_entry.rb +69 -0
  205. data/lib/rbs/environment/module_entry.rb +66 -0
  206. data/lib/rbs/environment/use_map.rb +77 -0
  207. data/lib/rbs/environment.rb +1028 -0
  208. data/lib/rbs/environment_loader.rb +167 -0
  209. data/lib/rbs/environment_walker.rb +155 -0
  210. data/lib/rbs/errors.rb +634 -0
  211. data/lib/rbs/factory.rb +18 -0
  212. data/lib/rbs/file_finder.rb +28 -0
  213. data/lib/rbs/inline_parser/comment_association.rb +117 -0
  214. data/lib/rbs/inline_parser.rb +568 -0
  215. data/lib/rbs/location_aux.rb +170 -0
  216. data/lib/rbs/locator.rb +247 -0
  217. data/lib/rbs/method_type.rb +145 -0
  218. data/lib/rbs/namespace.rb +154 -0
  219. data/lib/rbs/parser/lex_result.rb +15 -0
  220. data/lib/rbs/parser/token.rb +23 -0
  221. data/lib/rbs/parser_aux.rb +142 -0
  222. data/lib/rbs/prototype/helpers.rb +197 -0
  223. data/lib/rbs/prototype/node_usage.rb +99 -0
  224. data/lib/rbs/prototype/rb.rb +816 -0
  225. data/lib/rbs/prototype/rbi.rb +625 -0
  226. data/lib/rbs/prototype/runtime/helpers.rb +59 -0
  227. data/lib/rbs/prototype/runtime/reflection.rb +19 -0
  228. data/lib/rbs/prototype/runtime/value_object_generator.rb +279 -0
  229. data/lib/rbs/prototype/runtime.rb +680 -0
  230. data/lib/rbs/repository.rb +127 -0
  231. data/lib/rbs/resolver/constant_resolver.rb +219 -0
  232. data/lib/rbs/resolver/type_name_resolver.rb +167 -0
  233. data/lib/rbs/rewriter.rb +70 -0
  234. data/lib/rbs/sorter.rb +198 -0
  235. data/lib/rbs/source.rb +99 -0
  236. data/lib/rbs/substitution.rb +83 -0
  237. data/lib/rbs/subtractor.rb +204 -0
  238. data/lib/rbs/test/errors.rb +80 -0
  239. data/lib/rbs/test/guaranteed.rb +30 -0
  240. data/lib/rbs/test/hook.rb +212 -0
  241. data/lib/rbs/test/observer.rb +19 -0
  242. data/lib/rbs/test/setup.rb +84 -0
  243. data/lib/rbs/test/setup_helper.rb +50 -0
  244. data/lib/rbs/test/tester.rb +167 -0
  245. data/lib/rbs/test/type_check.rb +457 -0
  246. data/lib/rbs/test.rb +112 -0
  247. data/lib/rbs/type_alias_dependency.rb +100 -0
  248. data/lib/rbs/type_alias_regularity.rb +126 -0
  249. data/lib/rbs/type_name.rb +122 -0
  250. data/lib/rbs/types.rb +1604 -0
  251. data/lib/rbs/unit_test/convertibles.rb +177 -0
  252. data/lib/rbs/unit_test/spy.rb +138 -0
  253. data/lib/rbs/unit_test/type_assertions.rb +383 -0
  254. data/lib/rbs/unit_test/with_aliases.rb +145 -0
  255. data/lib/rbs/unit_test.rb +6 -0
  256. data/lib/rbs/validator.rb +186 -0
  257. data/lib/rbs/variance_calculator.rb +189 -0
  258. data/lib/rbs/vendorer.rb +71 -0
  259. data/lib/rbs/version.rb +5 -0
  260. data/lib/rbs/wasm/deserializer.rb +213 -0
  261. data/lib/rbs/wasm/jars/asm-analysis.jar +0 -0
  262. data/lib/rbs/wasm/jars/asm-commons.jar +0 -0
  263. data/lib/rbs/wasm/jars/asm-tree.jar +0 -0
  264. data/lib/rbs/wasm/jars/asm-util.jar +0 -0
  265. data/lib/rbs/wasm/jars/asm.jar +0 -0
  266. data/lib/rbs/wasm/jars/compiler.jar +0 -0
  267. data/lib/rbs/wasm/jars/log.jar +0 -0
  268. data/lib/rbs/wasm/jars/runtime.jar +0 -0
  269. data/lib/rbs/wasm/jars/wasi.jar +0 -0
  270. data/lib/rbs/wasm/jars/wasm.jar +0 -0
  271. data/lib/rbs/wasm/location.rb +61 -0
  272. data/lib/rbs/wasm/parser.rb +137 -0
  273. data/lib/rbs/wasm/rbs_parser.wasm +0 -0
  274. data/lib/rbs/wasm/runtime.rb +217 -0
  275. data/lib/rbs/wasm/serialization_schema.rb +110 -0
  276. data/lib/rbs/writer.rb +424 -0
  277. data/lib/rbs.rb +117 -0
  278. data/lib/rdoc/discover.rb +20 -0
  279. data/lib/rdoc_plugin/parser.rb +163 -0
  280. data/rbs.gemspec +68 -0
  281. data/schema/annotation.json +14 -0
  282. data/schema/comment.json +26 -0
  283. data/schema/decls.json +326 -0
  284. data/schema/function.json +87 -0
  285. data/schema/location.json +56 -0
  286. data/schema/members.json +266 -0
  287. data/schema/methodType.json +50 -0
  288. data/schema/typeParam.json +52 -0
  289. data/schema/types.json +317 -0
  290. data/sig/ancestor_builder.rbs +163 -0
  291. data/sig/ancestor_graph.rbs +60 -0
  292. data/sig/annotate/annotations.rbs +102 -0
  293. data/sig/annotate/formatter.rbs +24 -0
  294. data/sig/annotate/rdoc_annotater.rbs +85 -0
  295. data/sig/annotate/rdoc_source.rbs +32 -0
  296. data/sig/annotation.rbs +27 -0
  297. data/sig/ast/ruby/annotations.rbs +470 -0
  298. data/sig/ast/ruby/comment_block.rbs +127 -0
  299. data/sig/ast/ruby/declarations.rbs +158 -0
  300. data/sig/ast/ruby/helpers/constant_helper.rbs +11 -0
  301. data/sig/ast/ruby/helpers/location_helper.rbs +15 -0
  302. data/sig/ast/ruby/members.rbs +198 -0
  303. data/sig/buffer.rbs +108 -0
  304. data/sig/builtin_names.rbs +44 -0
  305. data/sig/cli/colored_io.rbs +15 -0
  306. data/sig/cli/diff.rbs +15 -0
  307. data/sig/cli/validate.rbs +47 -0
  308. data/sig/cli.rbs +89 -0
  309. data/sig/collection/cleaner.rbs +13 -0
  310. data/sig/collection/config/lockfile.rbs +74 -0
  311. data/sig/collection/config/lockfile_generator.rbs +68 -0
  312. data/sig/collection/config.rbs +46 -0
  313. data/sig/collection/installer.rbs +17 -0
  314. data/sig/collection/sources.rbs +214 -0
  315. data/sig/collection.rbs +4 -0
  316. data/sig/comment.rbs +26 -0
  317. data/sig/constant.rbs +21 -0
  318. data/sig/declarations.rbs +274 -0
  319. data/sig/definition.rbs +232 -0
  320. data/sig/definition_builder.rbs +181 -0
  321. data/sig/diff.rbs +28 -0
  322. data/sig/directives.rbs +77 -0
  323. data/sig/environment/class_entry.rbs +50 -0
  324. data/sig/environment/module_entry.rbs +50 -0
  325. data/sig/environment.rbs +286 -0
  326. data/sig/environment_loader.rbs +111 -0
  327. data/sig/environment_walker.rbs +65 -0
  328. data/sig/errors.rbs +408 -0
  329. data/sig/factory.rbs +5 -0
  330. data/sig/file_finder.rbs +28 -0
  331. data/sig/inline_parser/comment_association.rbs +71 -0
  332. data/sig/inline_parser.rbs +126 -0
  333. data/sig/location.rbs +135 -0
  334. data/sig/locator.rbs +56 -0
  335. data/sig/manifest.yaml +5 -0
  336. data/sig/members.rbs +258 -0
  337. data/sig/method_builder.rbs +89 -0
  338. data/sig/method_types.rbs +58 -0
  339. data/sig/namespace.rbs +161 -0
  340. data/sig/parser.rbs +164 -0
  341. data/sig/prototype/helpers.rbs +29 -0
  342. data/sig/prototype/node_usage.rbs +20 -0
  343. data/sig/prototype/rb.rbs +96 -0
  344. data/sig/prototype/rbi.rbs +75 -0
  345. data/sig/prototype/runtime.rbs +182 -0
  346. data/sig/rbs.rbs +21 -0
  347. data/sig/rdoc/rbs.rbs +67 -0
  348. data/sig/repository.rbs +85 -0
  349. data/sig/resolver/constant_resolver.rbs +92 -0
  350. data/sig/resolver/context.rbs +34 -0
  351. data/sig/resolver/type_name_resolver.rbs +61 -0
  352. data/sig/rewriter.rbs +45 -0
  353. data/sig/shims/bundler.rbs +38 -0
  354. data/sig/shims/enumerable.rbs +5 -0
  355. data/sig/shims/rubygems.rbs +19 -0
  356. data/sig/sorter.rbs +41 -0
  357. data/sig/source.rbs +48 -0
  358. data/sig/substitution.rbs +48 -0
  359. data/sig/subtractor.rbs +37 -0
  360. data/sig/test/errors.rbs +52 -0
  361. data/sig/test/guranteed.rbs +9 -0
  362. data/sig/test/type_check.rbs +19 -0
  363. data/sig/test.rbs +82 -0
  364. data/sig/type_alias_dependency.rbs +53 -0
  365. data/sig/type_alias_regularity.rbs +98 -0
  366. data/sig/type_param.rbs +115 -0
  367. data/sig/typename.rbs +89 -0
  368. data/sig/types.rbs +578 -0
  369. data/sig/unit_test/convertibles.rbs +154 -0
  370. data/sig/unit_test/spy.rbs +22 -0
  371. data/sig/unit_test/type_assertions.rbs +211 -0
  372. data/sig/unit_test/with_aliases.rbs +136 -0
  373. data/sig/use_map.rbs +35 -0
  374. data/sig/util.rbs +9 -0
  375. data/sig/validator.rbs +63 -0
  376. data/sig/variance_calculator.rbs +87 -0
  377. data/sig/vendorer.rbs +51 -0
  378. data/sig/version.rbs +3 -0
  379. data/sig/visitor.rbs +47 -0
  380. data/sig/wasm/deserializer.rbs +66 -0
  381. data/sig/wasm/serialization_schema.rbs +13 -0
  382. data/sig/writer.rbs +127 -0
  383. data/src/ast.c +1628 -0
  384. data/src/lexer.c +3217 -0
  385. data/src/lexer.re +155 -0
  386. data/src/lexstate.c +217 -0
  387. data/src/location.c +31 -0
  388. data/src/parser.c +4255 -0
  389. data/src/serialize.c +958 -0
  390. data/src/string.c +41 -0
  391. data/src/util/rbs_allocator.c +162 -0
  392. data/src/util/rbs_assert.c +19 -0
  393. data/src/util/rbs_buffer.c +54 -0
  394. data/src/util/rbs_constant_pool.c +268 -0
  395. data/src/util/rbs_encoding.c +21308 -0
  396. data/src/util/rbs_unescape.c +167 -0
  397. data/stdlib/abbrev/0/abbrev.rbs +66 -0
  398. data/stdlib/abbrev/0/array.rbs +26 -0
  399. data/stdlib/base64/0/base64.rbs +355 -0
  400. data/stdlib/benchmark/0/benchmark.rbs +452 -0
  401. data/stdlib/bigdecimal/0/big_decimal.rbs +1647 -0
  402. data/stdlib/bigdecimal-math/0/big_math.rbs +280 -0
  403. data/stdlib/bigdecimal-math/0/manifest.yaml +2 -0
  404. data/stdlib/cgi/0/core.rbs +911 -0
  405. data/stdlib/cgi/0/manifest.yaml +4 -0
  406. data/stdlib/cgi-escape/0/escape.rbs +171 -0
  407. data/stdlib/coverage/0/coverage.rbs +266 -0
  408. data/stdlib/csv/0/csv.rbs +3776 -0
  409. data/stdlib/csv/0/manifest.yaml +3 -0
  410. data/stdlib/date/0/date.rbs +1598 -0
  411. data/stdlib/date/0/date_time.rbs +617 -0
  412. data/stdlib/date/0/time.rbs +26 -0
  413. data/stdlib/dbm/0/dbm.rbs +421 -0
  414. data/stdlib/delegate/0/delegator.rbs +187 -0
  415. data/stdlib/delegate/0/kernel.rbs +47 -0
  416. data/stdlib/delegate/0/simple_delegator.rbs +96 -0
  417. data/stdlib/did_you_mean/0/did_you_mean.rbs +344 -0
  418. data/stdlib/digest/0/digest.rbs +687 -0
  419. data/stdlib/erb/0/erb.rbs +933 -0
  420. data/stdlib/etc/0/etc.rbs +884 -0
  421. data/stdlib/fileutils/0/fileutils.rbs +1753 -0
  422. data/stdlib/find/0/find.rbs +49 -0
  423. data/stdlib/forwardable/0/forwardable.rbs +271 -0
  424. data/stdlib/io-console/0/io-console.rbs +414 -0
  425. data/stdlib/ipaddr/0/ipaddr.rbs +436 -0
  426. data/stdlib/json/0/json.rbs +1963 -0
  427. data/stdlib/kconv/0/kconv.rbs +166 -0
  428. data/stdlib/logger/0/formatter.rbs +45 -0
  429. data/stdlib/logger/0/log_device.rbs +100 -0
  430. data/stdlib/logger/0/logger.rbs +796 -0
  431. data/stdlib/logger/0/manifest.yaml +2 -0
  432. data/stdlib/logger/0/period.rbs +17 -0
  433. data/stdlib/logger/0/severity.rbs +34 -0
  434. data/stdlib/minitest/0/kernel.rbs +42 -0
  435. data/stdlib/minitest/0/minitest/abstract_reporter.rbs +52 -0
  436. data/stdlib/minitest/0/minitest/assertion.rbs +17 -0
  437. data/stdlib/minitest/0/minitest/assertions.rbs +590 -0
  438. data/stdlib/minitest/0/minitest/backtrace_filter.rbs +23 -0
  439. data/stdlib/minitest/0/minitest/bench_spec.rbs +102 -0
  440. data/stdlib/minitest/0/minitest/benchmark.rbs +259 -0
  441. data/stdlib/minitest/0/minitest/composite_reporter.rbs +25 -0
  442. data/stdlib/minitest/0/minitest/compress.rbs +13 -0
  443. data/stdlib/minitest/0/minitest/error_on_warning.rbs +3 -0
  444. data/stdlib/minitest/0/minitest/expectation.rbs +2 -0
  445. data/stdlib/minitest/0/minitest/expectations.rbs +21 -0
  446. data/stdlib/minitest/0/minitest/guard.rbs +64 -0
  447. data/stdlib/minitest/0/minitest/mock.rbs +64 -0
  448. data/stdlib/minitest/0/minitest/parallel/executor.rbs +46 -0
  449. data/stdlib/minitest/0/minitest/parallel/test/class_methods.rbs +5 -0
  450. data/stdlib/minitest/0/minitest/parallel/test.rbs +3 -0
  451. data/stdlib/minitest/0/minitest/parallel.rbs +2 -0
  452. data/stdlib/minitest/0/minitest/pride_io.rbs +62 -0
  453. data/stdlib/minitest/0/minitest/pride_lol.rbs +19 -0
  454. data/stdlib/minitest/0/minitest/progress_reporter.rbs +11 -0
  455. data/stdlib/minitest/0/minitest/reportable.rbs +53 -0
  456. data/stdlib/minitest/0/minitest/reporter.rbs +5 -0
  457. data/stdlib/minitest/0/minitest/result.rbs +28 -0
  458. data/stdlib/minitest/0/minitest/runnable.rbs +163 -0
  459. data/stdlib/minitest/0/minitest/skip.rbs +6 -0
  460. data/stdlib/minitest/0/minitest/spec/dsl/instance_methods.rbs +48 -0
  461. data/stdlib/minitest/0/minitest/spec/dsl.rbs +129 -0
  462. data/stdlib/minitest/0/minitest/spec.rbs +11 -0
  463. data/stdlib/minitest/0/minitest/statistics_reporter.rbs +81 -0
  464. data/stdlib/minitest/0/minitest/summary_reporter.rbs +18 -0
  465. data/stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs +92 -0
  466. data/stdlib/minitest/0/minitest/test.rbs +69 -0
  467. data/stdlib/minitest/0/minitest/unexpected_error.rbs +12 -0
  468. data/stdlib/minitest/0/minitest/unexpected_warning.rbs +6 -0
  469. data/stdlib/minitest/0/minitest/unit/test_case.rbs +3 -0
  470. data/stdlib/minitest/0/minitest/unit.rbs +4 -0
  471. data/stdlib/minitest/0/minitest.rbs +115 -0
  472. data/stdlib/monitor/0/monitor.rbs +363 -0
  473. data/stdlib/mutex_m/0/mutex_m.rbs +104 -0
  474. data/stdlib/net-http/0/manifest.yaml +3 -0
  475. data/stdlib/net-http/0/net-http.rbs +5580 -0
  476. data/stdlib/net-protocol/0/manifest.yaml +2 -0
  477. data/stdlib/net-protocol/0/net-protocol.rbs +56 -0
  478. data/stdlib/net-smtp/0/manifest.yaml +2 -0
  479. data/stdlib/net-smtp/0/net-smtp.rbs +55 -0
  480. data/stdlib/nkf/0/nkf.rbs +402 -0
  481. data/stdlib/objspace/0/objspace.rbs +470 -0
  482. data/stdlib/observable/0/observable.rbs +217 -0
  483. data/stdlib/open-uri/0/manifest.yaml +4 -0
  484. data/stdlib/open-uri/0/open-uri.rbs +433 -0
  485. data/stdlib/open3/0/open3.rbs +606 -0
  486. data/stdlib/openssl/0/manifest.yaml +3 -0
  487. data/stdlib/openssl/0/openssl.rbs +12231 -0
  488. data/stdlib/optparse/0/optparse.rbs +1734 -0
  489. data/stdlib/pathname/0/pathname.rbs +36 -0
  490. data/stdlib/pp/0/manifest.yaml +2 -0
  491. data/stdlib/pp/0/pp.rbs +301 -0
  492. data/stdlib/prettyprint/0/prettyprint.rbs +383 -0
  493. data/stdlib/pstore/0/pstore.rbs +608 -0
  494. data/stdlib/psych/0/core_ext.rbs +12 -0
  495. data/stdlib/psych/0/dbm.rbs +237 -0
  496. data/stdlib/psych/0/manifest.yaml +3 -0
  497. data/stdlib/psych/0/psych.rbs +455 -0
  498. data/stdlib/psych/0/store.rbs +57 -0
  499. data/stdlib/pty/0/pty.rbs +240 -0
  500. data/stdlib/random-formatter/0/random-formatter.rbs +277 -0
  501. data/stdlib/rdoc/0/code_object.rbs +52 -0
  502. data/stdlib/rdoc/0/comment.rbs +61 -0
  503. data/stdlib/rdoc/0/context.rbs +153 -0
  504. data/stdlib/rdoc/0/markup.rbs +117 -0
  505. data/stdlib/rdoc/0/options.rbs +76 -0
  506. data/stdlib/rdoc/0/parser.rbs +56 -0
  507. data/stdlib/rdoc/0/rdoc.rbs +393 -0
  508. data/stdlib/rdoc/0/ri.rbs +17 -0
  509. data/stdlib/rdoc/0/store.rbs +48 -0
  510. data/stdlib/rdoc/0/top_level.rbs +97 -0
  511. data/stdlib/resolv/0/manifest.yaml +3 -0
  512. data/stdlib/resolv/0/resolv.rbs +1787 -0
  513. data/stdlib/ripper/0/ripper.rbs +1654 -0
  514. data/stdlib/securerandom/0/manifest.yaml +2 -0
  515. data/stdlib/securerandom/0/securerandom.rbs +49 -0
  516. data/stdlib/shellwords/0/shellwords.rbs +229 -0
  517. data/stdlib/singleton/0/singleton.rbs +134 -0
  518. data/stdlib/socket/0/addrinfo.rbs +666 -0
  519. data/stdlib/socket/0/basic_socket.rbs +590 -0
  520. data/stdlib/socket/0/constants.rbs +2295 -0
  521. data/stdlib/socket/0/ip_socket.rbs +94 -0
  522. data/stdlib/socket/0/socket.rbs +4170 -0
  523. data/stdlib/socket/0/socket_error.rbs +5 -0
  524. data/stdlib/socket/0/tcp_server.rbs +192 -0
  525. data/stdlib/socket/0/tcp_socket.rbs +87 -0
  526. data/stdlib/socket/0/udp_socket.rbs +133 -0
  527. data/stdlib/socket/0/unix_server.rbs +169 -0
  528. data/stdlib/socket/0/unix_socket.rbs +172 -0
  529. data/stdlib/stringio/0/stringio.rbs +1681 -0
  530. data/stdlib/strscan/0/string_scanner.rbs +1648 -0
  531. data/stdlib/tempfile/0/tempfile.rbs +483 -0
  532. data/stdlib/time/0/time.rbs +434 -0
  533. data/stdlib/timeout/0/timeout.rbs +137 -0
  534. data/stdlib/tmpdir/0/tmpdir.rbs +69 -0
  535. data/stdlib/tsort/0/cyclic.rbs +8 -0
  536. data/stdlib/tsort/0/interfaces.rbs +20 -0
  537. data/stdlib/tsort/0/tsort.rbs +410 -0
  538. data/stdlib/uri/0/common.rbs +621 -0
  539. data/stdlib/uri/0/file.rbs +118 -0
  540. data/stdlib/uri/0/ftp.rbs +13 -0
  541. data/stdlib/uri/0/generic.rbs +1116 -0
  542. data/stdlib/uri/0/http.rbs +104 -0
  543. data/stdlib/uri/0/https.rbs +14 -0
  544. data/stdlib/uri/0/ldap.rbs +230 -0
  545. data/stdlib/uri/0/ldaps.rbs +14 -0
  546. data/stdlib/uri/0/mailto.rbs +92 -0
  547. data/stdlib/uri/0/rfc2396_parser.rbs +189 -0
  548. data/stdlib/uri/0/rfc3986_parser.rbs +2 -0
  549. data/stdlib/uri/0/ws.rbs +13 -0
  550. data/stdlib/uri/0/wss.rbs +9 -0
  551. data/stdlib/yaml/0/manifest.yaml +2 -0
  552. data/stdlib/yaml/0/yaml.rbs +1 -0
  553. data/stdlib/zlib/0/buf_error.rbs +10 -0
  554. data/stdlib/zlib/0/data_error.rbs +10 -0
  555. data/stdlib/zlib/0/deflate.rbs +211 -0
  556. data/stdlib/zlib/0/error.rbs +20 -0
  557. data/stdlib/zlib/0/gzip_file/crc_error.rbs +12 -0
  558. data/stdlib/zlib/0/gzip_file/error.rbs +23 -0
  559. data/stdlib/zlib/0/gzip_file/length_error.rbs +12 -0
  560. data/stdlib/zlib/0/gzip_file/no_footer.rbs +11 -0
  561. data/stdlib/zlib/0/gzip_file.rbs +156 -0
  562. data/stdlib/zlib/0/gzip_reader.rbs +293 -0
  563. data/stdlib/zlib/0/gzip_writer.rbs +168 -0
  564. data/stdlib/zlib/0/inflate.rbs +180 -0
  565. data/stdlib/zlib/0/mem_error.rbs +10 -0
  566. data/stdlib/zlib/0/need_dict.rbs +13 -0
  567. data/stdlib/zlib/0/stream_end.rbs +11 -0
  568. data/stdlib/zlib/0/stream_error.rbs +11 -0
  569. data/stdlib/zlib/0/version_error.rbs +11 -0
  570. data/stdlib/zlib/0/zlib.rbs +449 -0
  571. data/stdlib/zlib/0/zstream.rbs +201 -0
  572. data/wasm/README.md +59 -0
  573. data/wasm/rbs_wasm.c +411 -0
  574. metadata +660 -0
@@ -0,0 +1,1598 @@
1
+ # <!-- rdoc-file=ext/date/date_core.c -->
2
+ # Class Date provides methods for storing and manipulating calendar dates.
3
+ #
4
+ # Consider using [class Time](rdoc-ref:Time) instead of class Date if:
5
+ #
6
+ # * You need both dates and times; Date handles only dates.
7
+ # * You need only Gregorian dates (and not Julian dates); see [Julian and
8
+ # Gregorian Calendars](rdoc-ref:language/calendars.rdoc).
9
+ #
10
+ # A Date object, once created, is immutable, and cannot be modified.
11
+ #
12
+ # ## Creating a Date
13
+ #
14
+ # You can create a date for the current date, using Date.today:
15
+ #
16
+ # Date.today # => #<Date: 1999-12-31>
17
+ #
18
+ # You can create a specific date from various combinations of arguments:
19
+ #
20
+ # * Date.new takes integer year, month, and day-of-month:
21
+ #
22
+ # Date.new(1999, 12, 31) # => #<Date: 1999-12-31>
23
+ #
24
+ # * Date.ordinal takes integer year and day-of-year:
25
+ #
26
+ # Date.ordinal(1999, 365) # => #<Date: 1999-12-31>
27
+ #
28
+ # * Date.jd takes integer Julian day:
29
+ #
30
+ # Date.jd(2451544) # => #<Date: 1999-12-31>
31
+ #
32
+ # * Date.commercial takes integer commercial data (year, week, day-of-week):
33
+ #
34
+ # Date.commercial(1999, 52, 5) # => #<Date: 1999-12-31>
35
+ #
36
+ # * Date.parse takes a string, which it parses heuristically:
37
+ #
38
+ # Date.parse('1999-12-31') # => #<Date: 1999-12-31>
39
+ # Date.parse('31-12-1999') # => #<Date: 1999-12-31>
40
+ # Date.parse('1999-365') # => #<Date: 1999-12-31>
41
+ # Date.parse('1999-W52-5') # => #<Date: 1999-12-31>
42
+ #
43
+ # * Date.strptime takes a date string and a format string, then parses the
44
+ # date string according to the format string:
45
+ #
46
+ # Date.strptime('1999-12-31', '%Y-%m-%d') # => #<Date: 1999-12-31>
47
+ # Date.strptime('31-12-1999', '%d-%m-%Y') # => #<Date: 1999-12-31>
48
+ # Date.strptime('1999-365', '%Y-%j') # => #<Date: 1999-12-31>
49
+ # Date.strptime('1999-W52-5', '%G-W%V-%u') # => #<Date: 1999-12-31>
50
+ # Date.strptime('1999 52 5', '%Y %U %w') # => #<Date: 1999-12-31>
51
+ # Date.strptime('1999 52 5', '%Y %W %u') # => #<Date: 1999-12-31>
52
+ # Date.strptime('fri31dec99', '%a%d%b%y') # => #<Date: 1999-12-31>
53
+ #
54
+ # See also the specialized methods in ["Specialized Format Strings" in Formats
55
+ # for Dates and
56
+ # Times](rdoc-ref:language/strftime_formatting.rdoc@Specialized+Format+Strings)
57
+ #
58
+ # ## Argument `limit`
59
+ #
60
+ # Certain singleton methods in Date that parse string arguments also take
61
+ # optional keyword argument `limit`, which can limit the length of the string
62
+ # argument.
63
+ #
64
+ # When `limit` is:
65
+ #
66
+ # * Non-negative: raises ArgumentError if the string length is greater than
67
+ # *limit*.
68
+ # * Other numeric or `nil`: ignores `limit`.
69
+ # * Other non-numeric: raises TypeError.
70
+ #
71
+ class Date
72
+ # <!--
73
+ # rdoc-file=ext/date/date_core.c
74
+ # - Date.new(year = -4712, month = 1, mday = 1, start = Date::ITALY) -> date
75
+ # -->
76
+ # Returns a new Date object constructed from the given arguments:
77
+ #
78
+ # Date.new(2022).to_s # => "2022-01-01"
79
+ # Date.new(2022, 2).to_s # => "2022-02-01"
80
+ # Date.new(2022, 2, 4).to_s # => "2022-02-04"
81
+ #
82
+ # Argument `month` should be in range (1..12) or range (-12..-1); when the
83
+ # argument is negative, counts backward from the end of the year:
84
+ #
85
+ # Date.new(2022, -11, 4).to_s # => "2022-02-04"
86
+ #
87
+ # Argument `mday` should be in range (1..n) or range (-n..-1) where `n` is the
88
+ # number of days in the month; when the argument is negative, counts backward
89
+ # from the end of the month.
90
+ #
91
+ # See argument [start](rdoc-ref:language/calendars.rdoc@Argument+start).
92
+ #
93
+ # Related: Date.jd.
94
+ #
95
+ def initialize: (?Integer year, ?Integer month, ?Integer mday, ?Integer start) -> void
96
+
97
+ include Comparable
98
+
99
+ # <!--
100
+ # rdoc-file=ext/date/date_core.c
101
+ # - Date._httpdate(string, limit: 128) -> hash
102
+ # -->
103
+ # Returns a hash of values parsed from `string`, which should be a valid [HTTP
104
+ # date format](rdoc-ref:language/strftime_formatting.rdoc@HTTP+Format):
105
+ #
106
+ # d = Date.new(2001, 2, 3)
107
+ # s = d.httpdate # => "Sat, 03 Feb 2001 00:00:00 GMT"
108
+ # Date._httpdate(s)
109
+ # # => {:wday=>6, :mday=>3, :mon=>2, :year=>2001, :hour=>0, :min=>0, :sec=>0, :zone=>"GMT", :offset=>0}
110
+ #
111
+ # Related: Date.httpdate (returns a Date object).
112
+ #
113
+ def self._httpdate: (String str) -> Hash[Symbol, Integer]
114
+
115
+ # <!--
116
+ # rdoc-file=ext/date/date_core.c
117
+ # - Date._iso8601(string, limit: 128) -> hash
118
+ # -->
119
+ # Returns a hash of values parsed from `string`, which should contain an [ISO
120
+ # 8601 formatted
121
+ # date](rdoc-ref:language/strftime_formatting.rdoc@ISO+8601+Format+Specification
122
+ # s):
123
+ #
124
+ # d = Date.new(2001, 2, 3)
125
+ # s = d.iso8601 # => "2001-02-03"
126
+ # Date._iso8601(s) # => {:mday=>3, :year=>2001, :mon=>2}
127
+ #
128
+ # See argument [limit](rdoc-ref:Date@Argument+limit).
129
+ #
130
+ # Related: Date.iso8601 (returns a Date object).
131
+ #
132
+ def self._iso8601: (String str) -> Hash[Symbol, Integer]
133
+
134
+ # <!--
135
+ # rdoc-file=ext/date/date_core.c
136
+ # - Date._jisx0301(string, limit: 128) -> hash
137
+ # -->
138
+ # Returns a hash of values parsed from `string`, which should be a valid [JIS X
139
+ # 0301 date
140
+ # format](rdoc-ref:language/strftime_formatting.rdoc@JIS+X+0301+Format):
141
+ #
142
+ # d = Date.new(2001, 2, 3)
143
+ # s = d.jisx0301 # => "H13.02.03"
144
+ # Date._jisx0301(s) # => {:year=>2001, :mon=>2, :mday=>3}
145
+ #
146
+ # See argument [limit](rdoc-ref:Date@Argument+limit).
147
+ #
148
+ # Related: Date.jisx0301 (returns a Date object).
149
+ #
150
+ def self._jisx0301: (String str) -> Hash[Symbol, Integer]
151
+
152
+ # <!--
153
+ # rdoc-file=ext/date/date_core.c
154
+ # - Date._parse(string, comp = true, limit: 128) -> hash
155
+ # -->
156
+ # **Note**: This method recognizes many forms in `string`, but it is not a
157
+ # validator. For formats, see ["Specialized Format Strings" in Formats for Dates
158
+ # and
159
+ # Times](rdoc-ref:language/strftime_formatting.rdoc@Specialized+Format+Strings)
160
+ #
161
+ # If `string` does not specify a valid date, the result is unpredictable;
162
+ # consider using Date._strptime instead.
163
+ #
164
+ # Returns a hash of values parsed from `string`:
165
+ #
166
+ # Date._parse('2001-02-03') # => {:year=>2001, :mon=>2, :mday=>3}
167
+ #
168
+ # If `comp` is `true` and the given year is in the range <code>(0..99)</code>,
169
+ # the current century is supplied; otherwise, the year is taken as given:
170
+ #
171
+ # Date._parse('01-02-03', true) # => {:year=>2001, :mon=>2, :mday=>3}
172
+ # Date._parse('01-02-03', false) # => {:year=>1, :mon=>2, :mday=>3}
173
+ #
174
+ # See argument [limit](rdoc-ref:Date@Argument+limit).
175
+ #
176
+ # Related: Date.parse(returns a Date object).
177
+ #
178
+ def self._parse: (String str, ?boolish complete) -> Hash[Symbol, Integer]
179
+
180
+ # <!--
181
+ # rdoc-file=ext/date/date_core.c
182
+ # - Date._rfc2822(string, limit: 128) -> hash
183
+ # -->
184
+ # Returns a hash of values parsed from `string`, which should be a valid [RFC
185
+ # 2822 date format](rdoc-ref:language/strftime_formatting.rdoc@RFC+2822+Format):
186
+ #
187
+ # d = Date.new(2001, 2, 3)
188
+ # s = d.rfc2822 # => "Sat, 3 Feb 2001 00:00:00 +0000"
189
+ # Date._rfc2822(s)
190
+ # # => {:wday=>6, :mday=>3, :mon=>2, :year=>2001, :hour=>0, :min=>0, :sec=>0, :zone=>"+0000", :offset=>0}
191
+ #
192
+ # See argument [limit](rdoc-ref:Date@Argument+limit).
193
+ #
194
+ # Related: Date.rfc2822 (returns a Date object).
195
+ #
196
+ def self._rfc2822: (String str) -> Hash[Symbol, Integer | String]
197
+
198
+ # <!--
199
+ # rdoc-file=ext/date/date_core.c
200
+ # - Date._rfc3339(string, limit: 128) -> hash
201
+ # -->
202
+ # Returns a hash of values parsed from `string`, which should be a valid [RFC
203
+ # 3339 format](rdoc-ref:language/strftime_formatting.rdoc@RFC+3339+Format):
204
+ #
205
+ # d = Date.new(2001, 2, 3)
206
+ # s = d.rfc3339 # => "2001-02-03T00:00:00+00:00"
207
+ # Date._rfc3339(s)
208
+ # # => {:year=>2001, :mon=>2, :mday=>3, :hour=>0, :min=>0, :sec=>0, :zone=>"+00:00", :offset=>0}
209
+ #
210
+ # See argument [limit](rdoc-ref:Date@Argument+limit).
211
+ #
212
+ # Related: Date.rfc3339 (returns a Date object).
213
+ #
214
+ def self._rfc3339: (String str) -> Hash[Symbol, Integer | String]
215
+
216
+ # <!--
217
+ # rdoc-file=ext/date/date_core.c
218
+ # - Date._rfc2822(string, limit: 128) -> hash
219
+ # -->
220
+ # Returns a hash of values parsed from `string`, which should be a valid [RFC
221
+ # 2822 date format](rdoc-ref:language/strftime_formatting.rdoc@RFC+2822+Format):
222
+ #
223
+ # d = Date.new(2001, 2, 3)
224
+ # s = d.rfc2822 # => "Sat, 3 Feb 2001 00:00:00 +0000"
225
+ # Date._rfc2822(s)
226
+ # # => {:wday=>6, :mday=>3, :mon=>2, :year=>2001, :hour=>0, :min=>0, :sec=>0, :zone=>"+0000", :offset=>0}
227
+ #
228
+ # See argument [limit](rdoc-ref:Date@Argument+limit).
229
+ #
230
+ # Related: Date.rfc2822 (returns a Date object).
231
+ #
232
+ def self._rfc822: (String str) -> Hash[Symbol, Integer | String]
233
+
234
+ # <!--
235
+ # rdoc-file=ext/date/date_core.c
236
+ # - Date._strptime(string, format = '%F') -> hash
237
+ # -->
238
+ # Returns a hash of values parsed from `string` according to the given `format`:
239
+ #
240
+ # Date._strptime('2001-02-03', '%Y-%m-%d') # => {:year=>2001, :mon=>2, :mday=>3}
241
+ #
242
+ # For other formats, see [Formats for Dates and
243
+ # Times](rdoc-ref:language/strftime_formatting.rdoc). (Unlike Date.strftime,
244
+ # does not support flags and width.)
245
+ #
246
+ # See also [strptime(3)](https://man7.org/linux/man-pages/man3/strptime.3.html).
247
+ #
248
+ # Related: Date.strptime (returns a Date object).
249
+ #
250
+ def self._strptime: (String str, ?String format) -> Hash[Symbol, Integer]
251
+
252
+ # <!--
253
+ # rdoc-file=ext/date/date_core.c
254
+ # - Date._xmlschema(string, limit: 128) -> hash
255
+ # -->
256
+ # Returns a hash of values parsed from `string`, which should be a valid XML
257
+ # date format:
258
+ #
259
+ # d = Date.new(2001, 2, 3)
260
+ # s = d.xmlschema # => "2001-02-03"
261
+ # Date._xmlschema(s) # => {:year=>2001, :mon=>2, :mday=>3}
262
+ #
263
+ # See argument [limit](rdoc-ref:Date@Argument+limit).
264
+ #
265
+ # Related: Date.xmlschema (returns a Date object).
266
+ #
267
+ def self._xmlschema: (String str) -> Hash[Symbol, Integer]
268
+
269
+ # <!--
270
+ # rdoc-file=ext/date/date_core.c
271
+ # - civil(*args)
272
+ # -->
273
+ # Same as Date.new.
274
+ #
275
+ def self.civil: (?Integer year, ?Integer month, ?Integer mday, ?Integer start) -> Date
276
+
277
+ # <!--
278
+ # rdoc-file=ext/date/date_core.c
279
+ # - Date.commercial(cwyear = -4712, cweek = 1, cwday = 1, start = Date::ITALY) -> date
280
+ # -->
281
+ # Returns a new Date object constructed from the arguments.
282
+ #
283
+ # Argument `cwyear` gives the year, and should be an integer.
284
+ #
285
+ # Argument `cweek` gives the index of the week within the year, and should be in
286
+ # range (1..53) or (-53..-1); in some years, 53 or -53 will be out-of-range; if
287
+ # negative, counts backward from the end of the year:
288
+ #
289
+ # Date.commercial(2022, 1, 1).to_s # => "2022-01-03"
290
+ # Date.commercial(2022, 52, 1).to_s # => "2022-12-26"
291
+ #
292
+ # Argument `cwday` gives the indes of the weekday within the week, and should be
293
+ # in range (1..7) or (-7..-1); 1 or -7 is Monday; if negative, counts backward
294
+ # from the end of the week:
295
+ #
296
+ # Date.commercial(2022, 1, 1).to_s # => "2022-01-03"
297
+ # Date.commercial(2022, 1, -7).to_s # => "2022-01-03"
298
+ #
299
+ # When `cweek` is 1:
300
+ #
301
+ # * If January 1 is a Friday, Saturday, or Sunday, the first week begins in
302
+ # the week after:
303
+ #
304
+ # Date::ABBR_DAYNAMES[Date.new(2023, 1, 1).wday] # => "Sun"
305
+ # Date.commercial(2023, 1, 1).to_s # => "2023-01-02"
306
+ # Date.commercial(2023, 1, 7).to_s # => "2023-01-08"
307
+ #
308
+ # * Otherwise, the first week is the week of January 1, which may mean some of
309
+ # the days fall on the year before:
310
+ #
311
+ # Date::ABBR_DAYNAMES[Date.new(2020, 1, 1).wday] # => "Wed"
312
+ # Date.commercial(2020, 1, 1).to_s # => "2019-12-30"
313
+ # Date.commercial(2020, 1, 7).to_s # => "2020-01-05"
314
+ #
315
+ # See argument [start](rdoc-ref:language/calendars.rdoc@Argument+start).
316
+ #
317
+ # Related: Date.jd, Date.new, Date.ordinal.
318
+ #
319
+ def self.commercial: (?Integer cwyear, ?Integer cweek, ?Integer cwday, ?Integer start) -> Date
320
+
321
+ # <!--
322
+ # rdoc-file=ext/date/date_core.c
323
+ # - Date.gregorian_leap?(year) -> true or false
324
+ # -->
325
+ # Returns `true` if the given year is a leap year in the [proleptic Gregorian
326
+ # calendar](https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar), `false`
327
+ # otherwise:
328
+ #
329
+ # Date.gregorian_leap?(2000) # => true
330
+ # Date.gregorian_leap?(2001) # => false
331
+ #
332
+ # Related: Date.julian_leap?.
333
+ #
334
+ def self.gregorian_leap?: (Integer year) -> bool
335
+
336
+ # <!--
337
+ # rdoc-file=ext/date/date_core.c
338
+ # - Date.httpdate(string = 'Mon, 01 Jan -4712 00:00:00 GMT', start = Date::ITALY, limit: 128) -> date
339
+ # -->
340
+ # Returns a new Date object with values parsed from `string`, which should be a
341
+ # valid [HTTP date
342
+ # format](rdoc-ref:language/strftime_formatting.rdoc@HTTP+Format):
343
+ #
344
+ # d = Date.new(2001, 2, 3)
345
+ # s = d.httpdate # => "Sat, 03 Feb 2001 00:00:00 GMT"
346
+ # Date.httpdate(s) # => #<Date: 2001-02-03>
347
+ #
348
+ # See:
349
+ #
350
+ # * Argument [start](rdoc-ref:language/calendars.rdoc@Argument+start).
351
+ # * Argument [limit](rdoc-ref:Date@Argument+limit).
352
+ #
353
+ # Related: Date._httpdate (returns a hash).
354
+ #
355
+ def self.httpdate: (String str, ?Integer start) -> Date
356
+
357
+ # <!--
358
+ # rdoc-file=ext/date/date_core.c
359
+ # - Date.iso8601(string = '-4712-01-01', start = Date::ITALY, limit: 128) -> date
360
+ # -->
361
+ # Returns a new Date object with values parsed from `string`, which should
362
+ # contain an [ISO 8601 formatted
363
+ # date](rdoc-ref:language/strftime_formatting.rdoc@ISO+8601+Format+Specification
364
+ # s):
365
+ #
366
+ # d = Date.new(2001, 2, 3)
367
+ # s = d.iso8601 # => "2001-02-03"
368
+ # Date.iso8601(s) # => #<Date: 2001-02-03>
369
+ #
370
+ # See:
371
+ #
372
+ # * Argument [start](rdoc-ref:language/calendars.rdoc@Argument+start).
373
+ # * Argument [limit](rdoc-ref:Date@Argument+limit).
374
+ #
375
+ # Related: Date._iso8601 (returns a hash).
376
+ #
377
+ def self.iso8601: (String str, ?Integer start) -> Date
378
+
379
+ # <!--
380
+ # rdoc-file=ext/date/date_core.c
381
+ # - Date.jd(jd = 0, start = Date::ITALY) -> date
382
+ # -->
383
+ # Returns a new Date object formed from the arguments:
384
+ #
385
+ # Date.jd(2451944).to_s # => "2001-02-03"
386
+ # Date.jd(2451945).to_s # => "2001-02-04"
387
+ # Date.jd(0).to_s # => "-4712-01-01"
388
+ #
389
+ # The returned date is:
390
+ #
391
+ # * Gregorian, if the argument is greater than or equal to `start`:
392
+ #
393
+ # Date::ITALY # => 2299161
394
+ # Date.jd(Date::ITALY).gregorian? # => true
395
+ # Date.jd(Date::ITALY + 1).gregorian? # => true
396
+ #
397
+ # * Julian, otherwise
398
+ #
399
+ # Date.jd(Date::ITALY - 1).julian? # => true
400
+ #
401
+ # See argument [start](rdoc-ref:language/calendars.rdoc@Argument+start).
402
+ #
403
+ # Related: Date.new.
404
+ #
405
+ def self.jd: (Integer jd, ?Integer start) -> Date
406
+
407
+ # <!--
408
+ # rdoc-file=ext/date/date_core.c
409
+ # - Date.jisx0301(string = '-4712-01-01', start = Date::ITALY, limit: 128) -> date
410
+ # -->
411
+ # Returns a new Date object with values parsed from `string`, which should be a
412
+ # valid [JIS X 0301
413
+ # format](rdoc-ref:language/strftime_formatting.rdoc@JIS+X+0301+Format):
414
+ #
415
+ # d = Date.new(2001, 2, 3)
416
+ # s = d.jisx0301 # => "H13.02.03"
417
+ # Date.jisx0301(s) # => #<Date: 2001-02-03>
418
+ #
419
+ # For no-era year, legacy format, Heisei is assumed.
420
+ #
421
+ # Date.jisx0301('13.02.03') # => #<Date: 2001-02-03>
422
+ #
423
+ # See:
424
+ #
425
+ # * Argument [start](rdoc-ref:language/calendars.rdoc@Argument+start).
426
+ # * Argument [limit](rdoc-ref:Date@Argument+limit).
427
+ #
428
+ # Related: Date._jisx0301 (returns a hash).
429
+ #
430
+ def self.jisx0301: (String str, ?Integer start) -> Date
431
+
432
+ # <!--
433
+ # rdoc-file=ext/date/date_core.c
434
+ # - Date.julian_leap?(year) -> true or false
435
+ # -->
436
+ # Returns `true` if the given year is a leap year in the [proleptic Julian
437
+ # calendar](https://en.wikipedia.org/wiki/Proleptic_Julian_calendar), `false`
438
+ # otherwise:
439
+ #
440
+ # Date.julian_leap?(1900) # => true
441
+ # Date.julian_leap?(1901) # => false
442
+ #
443
+ # Related: Date.gregorian_leap?.
444
+ #
445
+ def self.julian_leap?: (Integer year) -> bool
446
+
447
+ # <!--
448
+ # rdoc-file=ext/date/date_core.c
449
+ # - Date.gregorian_leap?(year) -> true or false
450
+ # -->
451
+ # Returns `true` if the given year is a leap year in the [proleptic Gregorian
452
+ # calendar](https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar), `false`
453
+ # otherwise:
454
+ #
455
+ # Date.gregorian_leap?(2000) # => true
456
+ # Date.gregorian_leap?(2001) # => false
457
+ #
458
+ # Related: Date.julian_leap?.
459
+ #
460
+ def self.leap?: (Integer year) -> bool
461
+
462
+ # <!--
463
+ # rdoc-file=ext/date/date_core.c
464
+ # - Date.ordinal(year = -4712, yday = 1, start = Date::ITALY) -> date
465
+ # -->
466
+ # Returns a new Date object formed fom the arguments.
467
+ #
468
+ # With no arguments, returns the date for January 1, -4712:
469
+ #
470
+ # Date.ordinal.to_s # => "-4712-01-01"
471
+ #
472
+ # With argument `year`, returns the date for January 1 of that year:
473
+ #
474
+ # Date.ordinal(2001).to_s # => "2001-01-01"
475
+ # Date.ordinal(-2001).to_s # => "-2001-01-01"
476
+ #
477
+ # With positive argument `yday` == `n`, returns the date for the `nth` day of
478
+ # the given year:
479
+ #
480
+ # Date.ordinal(2001, 14).to_s # => "2001-01-14"
481
+ #
482
+ # With negative argument `yday`, counts backward from the end of the year:
483
+ #
484
+ # Date.ordinal(2001, -14).to_s # => "2001-12-18"
485
+ #
486
+ # Raises an exception if `yday` is zero or out of range.
487
+ #
488
+ # See argument [start](rdoc-ref:language/calendars.rdoc@Argument+start).
489
+ #
490
+ # Related: Date.jd, Date.new.
491
+ #
492
+ def self.ordinal: (?Integer year, ?Integer yday, ?Integer start) -> Date
493
+
494
+ # <!--
495
+ # rdoc-file=ext/date/date_core.c
496
+ # - Date.parse(string = '-4712-01-01', comp = true, start = Date::ITALY, limit: 128) -> date
497
+ # -->
498
+ # **Note**: This method recognizes many forms in `string`, but it is not a
499
+ # validator. For formats, see ["Specialized Format Strings" in Formats for Dates
500
+ # and
501
+ # Times](rdoc-ref:language/strftime_formatting.rdoc@Specialized+Format+Strings)
502
+ # If `string` does not specify a valid date, the result is unpredictable;
503
+ # consider using Date._strptime instead.
504
+ #
505
+ # Returns a new Date object with values parsed from `string`:
506
+ #
507
+ # Date.parse('2001-02-03') # => #<Date: 2001-02-03>
508
+ # Date.parse('20010203') # => #<Date: 2001-02-03>
509
+ # Date.parse('3rd Feb 2001') # => #<Date: 2001-02-03>
510
+ #
511
+ # If `comp` is `true` and the given year is in the range <code>(0..99)</code>,
512
+ # the current century is supplied; otherwise, the year is taken as given:
513
+ #
514
+ # Date.parse('01-02-03', true) # => #<Date: 2001-02-03>
515
+ # Date.parse('01-02-03', false) # => #<Date: 0001-02-03>
516
+ #
517
+ # See:
518
+ #
519
+ # * Argument [start](rdoc-ref:language/calendars.rdoc@Argument+start).
520
+ # * Argument [limit](rdoc-ref:Date@Argument+limit).
521
+ #
522
+ # Related: Date._parse (returns a hash).
523
+ #
524
+ def self.parse: (?String str, ?boolish complete, ?Integer start) -> Date
525
+
526
+ # <!--
527
+ # rdoc-file=ext/date/date_core.c
528
+ # - Date.rfc2822(string = 'Mon, 1 Jan -4712 00:00:00 +0000', start = Date::ITALY, limit: 128) -> date
529
+ # -->
530
+ # Returns a new Date object with values parsed from `string`, which should be a
531
+ # valid [RFC 2822 date
532
+ # format](rdoc-ref:language/strftime_formatting.rdoc@RFC+2822+Format):
533
+ #
534
+ # d = Date.new(2001, 2, 3)
535
+ # s = d.rfc2822 # => "Sat, 3 Feb 2001 00:00:00 +0000"
536
+ # Date.rfc2822(s) # => #<Date: 2001-02-03>
537
+ #
538
+ # See:
539
+ #
540
+ # * Argument [start](rdoc-ref:language/calendars.rdoc@Argument+start).
541
+ # * Argument [limit](rdoc-ref:Date@Argument+limit).
542
+ #
543
+ # Related: Date._rfc2822 (returns a hash).
544
+ #
545
+ def self.rfc2822: (String str, ?Integer start) -> Date
546
+
547
+ # <!--
548
+ # rdoc-file=ext/date/date_core.c
549
+ # - Date.rfc3339(string = '-4712-01-01T00:00:00+00:00', start = Date::ITALY, limit: 128) -> date
550
+ # -->
551
+ # Returns a new Date object with values parsed from `string`, which should be a
552
+ # valid [RFC 3339
553
+ # format](rdoc-ref:language/strftime_formatting.rdoc@RFC+3339+Format):
554
+ #
555
+ # d = Date.new(2001, 2, 3)
556
+ # s = d.rfc3339 # => "2001-02-03T00:00:00+00:00"
557
+ # Date.rfc3339(s) # => #<Date: 2001-02-03>
558
+ #
559
+ # See:
560
+ #
561
+ # * Argument [start](rdoc-ref:language/calendars.rdoc@Argument+start).
562
+ # * Argument [limit](rdoc-ref:Date@Argument+limit).
563
+ #
564
+ # Related: Date._rfc3339 (returns a hash).
565
+ #
566
+ def self.rfc3339: (String str, ?Integer start) -> Date
567
+
568
+ # <!--
569
+ # rdoc-file=ext/date/date_core.c
570
+ # - Date.rfc2822(string = 'Mon, 1 Jan -4712 00:00:00 +0000', start = Date::ITALY, limit: 128) -> date
571
+ # -->
572
+ # Returns a new Date object with values parsed from `string`, which should be a
573
+ # valid [RFC 2822 date
574
+ # format](rdoc-ref:language/strftime_formatting.rdoc@RFC+2822+Format):
575
+ #
576
+ # d = Date.new(2001, 2, 3)
577
+ # s = d.rfc2822 # => "Sat, 3 Feb 2001 00:00:00 +0000"
578
+ # Date.rfc2822(s) # => #<Date: 2001-02-03>
579
+ #
580
+ # See:
581
+ #
582
+ # * Argument [start](rdoc-ref:language/calendars.rdoc@Argument+start).
583
+ # * Argument [limit](rdoc-ref:Date@Argument+limit).
584
+ #
585
+ # Related: Date._rfc2822 (returns a hash).
586
+ #
587
+ def self.rfc822: (String str, ?Integer start) -> Date
588
+
589
+ # <!--
590
+ # rdoc-file=ext/date/date_core.c
591
+ # - Date.strptime(string = '-4712-01-01', format = '%F', start = Date::ITALY) -> date
592
+ # -->
593
+ # Returns a new Date object with values parsed from `string`, according to the
594
+ # given `format`:
595
+ #
596
+ # Date.strptime('2001-02-03', '%Y-%m-%d') # => #<Date: 2001-02-03>
597
+ # Date.strptime('03-02-2001', '%d-%m-%Y') # => #<Date: 2001-02-03>
598
+ # Date.strptime('2001-034', '%Y-%j') # => #<Date: 2001-02-03>
599
+ # Date.strptime('2001-W05-6', '%G-W%V-%u') # => #<Date: 2001-02-03>
600
+ # Date.strptime('2001 04 6', '%Y %U %w') # => #<Date: 2001-02-03>
601
+ # Date.strptime('2001 05 6', '%Y %W %u') # => #<Date: 2001-02-03>
602
+ # Date.strptime('sat3feb01', '%a%d%b%y') # => #<Date: 2001-02-03>
603
+ #
604
+ # For other formats, see [Formats for Dates and
605
+ # Times](rdoc-ref:language/strftime_formatting.rdoc). (Unlike Date.strftime,
606
+ # does not support flags and width.)
607
+ #
608
+ # See argument [start](rdoc-ref:language/calendars.rdoc@Argument+start).
609
+ #
610
+ # See also [strptime(3)](https://man7.org/linux/man-pages/man3/strptime.3.html).
611
+ #
612
+ # Related: Date._strptime (returns a hash).
613
+ #
614
+ def self.strptime: (String str, ?String format, ?Integer start) -> Date
615
+
616
+ # <!--
617
+ # rdoc-file=ext/date/date_core.c
618
+ # - Date.today(start = Date::ITALY) -> date
619
+ # -->
620
+ # Returns a new Date object constructed from the present date:
621
+ #
622
+ # Date.today.to_s # => "2022-07-06"
623
+ #
624
+ # See argument [start](rdoc-ref:language/calendars.rdoc@Argument+start).
625
+ #
626
+ def self.today: (?Integer start) -> Date
627
+
628
+ # <!--
629
+ # rdoc-file=ext/date/date_core.c
630
+ # - Date.valid_civil?(year, month, mday, start = Date::ITALY) -> true or false
631
+ # -->
632
+ # Returns `true` if the arguments define a valid ordinal date, `false`
633
+ # otherwise:
634
+ #
635
+ # Date.valid_date?(2001, 2, 3) # => true
636
+ # Date.valid_date?(2001, 2, 29) # => false
637
+ # Date.valid_date?(2001, 2, -1) # => true
638
+ #
639
+ # See argument [start](rdoc-ref:language/calendars.rdoc@Argument+start).
640
+ #
641
+ # Related: Date.jd, Date.new.
642
+ #
643
+ def self.valid_civil?: (Integer year, Integer month, Integer mday, ?Integer start) -> bool
644
+
645
+ # <!--
646
+ # rdoc-file=ext/date/date_core.c
647
+ # - Date.valid_commercial?(cwyear, cweek, cwday, start = Date::ITALY) -> true or false
648
+ # -->
649
+ # Returns `true` if the arguments define a valid commercial date, `false`
650
+ # otherwise:
651
+ #
652
+ # Date.valid_commercial?(2001, 5, 6) # => true
653
+ # Date.valid_commercial?(2001, 5, 8) # => false
654
+ #
655
+ # See Date.commercial.
656
+ #
657
+ # See argument [start](rdoc-ref:language/calendars.rdoc@Argument+start).
658
+ #
659
+ # Related: Date.jd, Date.commercial.
660
+ #
661
+ def self.valid_commercial?: (Integer cwyear, Integer cweek, Integer cwday, ?Integer start) -> bool
662
+
663
+ # <!--
664
+ # rdoc-file=ext/date/date_core.c
665
+ # - Date.valid_civil?(year, month, mday, start = Date::ITALY) -> true or false
666
+ # -->
667
+ # Returns `true` if the arguments define a valid ordinal date, `false`
668
+ # otherwise:
669
+ #
670
+ # Date.valid_date?(2001, 2, 3) # => true
671
+ # Date.valid_date?(2001, 2, 29) # => false
672
+ # Date.valid_date?(2001, 2, -1) # => true
673
+ #
674
+ # See argument [start](rdoc-ref:language/calendars.rdoc@Argument+start).
675
+ #
676
+ # Related: Date.jd, Date.new.
677
+ #
678
+ def self.valid_date?: (Integer year, Integer month, Integer mday, ?Integer start) -> bool
679
+
680
+ # <!--
681
+ # rdoc-file=ext/date/date_core.c
682
+ # - Date.valid_jd?(jd, start = Date::ITALY) -> true
683
+ # -->
684
+ # Implemented for compatibility; returns `true` unless `jd` is invalid (i.e.,
685
+ # not a Numeric).
686
+ #
687
+ # Date.valid_jd?(2451944) # => true
688
+ #
689
+ # See argument [start](rdoc-ref:language/calendars.rdoc@Argument+start).
690
+ #
691
+ # Related: Date.jd.
692
+ #
693
+ def self.valid_jd?: (Integer jd, ?Integer start) -> bool
694
+
695
+ # <!--
696
+ # rdoc-file=ext/date/date_core.c
697
+ # - Date.valid_ordinal?(year, yday, start = Date::ITALY) -> true or false
698
+ # -->
699
+ # Returns `true` if the arguments define a valid ordinal date, `false`
700
+ # otherwise:
701
+ #
702
+ # Date.valid_ordinal?(2001, 34) # => true
703
+ # Date.valid_ordinal?(2001, 366) # => false
704
+ #
705
+ # See argument [start](rdoc-ref:language/calendars.rdoc@Argument+start).
706
+ #
707
+ # Related: Date.jd, Date.ordinal.
708
+ #
709
+ def self.valid_ordinal?: (Integer year, Integer yday, ?Integer start) -> bool
710
+
711
+ # <!--
712
+ # rdoc-file=ext/date/date_core.c
713
+ # - Date.xmlschema(string = '-4712-01-01', start = Date::ITALY, limit: 128) -> date
714
+ # -->
715
+ # Returns a new Date object with values parsed from `string`, which should be a
716
+ # valid XML date format:
717
+ #
718
+ # d = Date.new(2001, 2, 3)
719
+ # s = d.xmlschema # => "2001-02-03"
720
+ # Date.xmlschema(s) # => #<Date: 2001-02-03>
721
+ #
722
+ # See:
723
+ #
724
+ # * Argument [start](rdoc-ref:language/calendars.rdoc@Argument+start).
725
+ # * Argument [limit](rdoc-ref:Date@Argument+limit).
726
+ #
727
+ # Related: Date._xmlschema (returns a hash).
728
+ #
729
+ def self.xmlschema: (String str, ?Integer start) -> Date
730
+
731
+ # <!--
732
+ # rdoc-file=ext/date/date_core.c
733
+ # - d + other -> date
734
+ # -->
735
+ # Returns a date object pointing `other` days after self. The other should be a
736
+ # numeric value. If the other is a fractional number, assumes its precision is
737
+ # at most nanosecond.
738
+ #
739
+ # Date.new(2001,2,3) + 1 #=> #<Date: 2001-02-04 ...>
740
+ # DateTime.new(2001,2,3) + Rational(1,2)
741
+ # #=> #<DateTime: 2001-02-03T12:00:00+00:00 ...>
742
+ # DateTime.new(2001,2,3) + Rational(-1,2)
743
+ # #=> #<DateTime: 2001-02-02T12:00:00+00:00 ...>
744
+ # DateTime.jd(0,12) + DateTime.new(2001,2,3).ajd
745
+ # #=> #<DateTime: 2001-02-03T00:00:00+00:00 ...>
746
+ #
747
+ def +: (Numeric & _ToR other) -> Date
748
+
749
+ # <!--
750
+ # rdoc-file=ext/date/date_core.c
751
+ # - d - other -> date or rational
752
+ # -->
753
+ # If the other is a date object, returns a Rational whose value is the
754
+ # difference between the two dates in days. If the other is a numeric value,
755
+ # returns a date object pointing `other` days before self. If the other is a
756
+ # fractional number, assumes its precision is at most nanosecond.
757
+ #
758
+ # Date.new(2001,2,3) - 1 #=> #<Date: 2001-02-02 ...>
759
+ # DateTime.new(2001,2,3) - Rational(1,2)
760
+ # #=> #<DateTime: 2001-02-02T12:00:00+00:00 ...>
761
+ # Date.new(2001,2,3) - Date.new(2001)
762
+ # #=> (33/1)
763
+ # DateTime.new(2001,2,3) - DateTime.new(2001,2,2,12)
764
+ # #=> (1/2)
765
+ #
766
+ def -: (Numeric & _ToR other) -> Date
767
+ | (Date other) -> Rational
768
+
769
+ # <!--
770
+ # rdoc-file=ext/date/date_core.c
771
+ # - d << n -> date
772
+ # -->
773
+ # Returns a new Date object representing the date `n` months earlier; `n` should
774
+ # be a numeric:
775
+ #
776
+ # (Date.new(2001, 2, 3) << 1).to_s # => "2001-01-03"
777
+ # (Date.new(2001, 2, 3) << -2).to_s # => "2001-04-03"
778
+ #
779
+ # When the same day does not exist for the new month, the last day of that month
780
+ # is used instead:
781
+ #
782
+ # (Date.new(2001, 3, 31) << 1).to_s # => "2001-02-28"
783
+ # (Date.new(2001, 3, 31) << -6).to_s # => "2001-09-30"
784
+ #
785
+ # This results in the following, possibly unexpected, behaviors:
786
+ #
787
+ # d0 = Date.new(2001, 3, 31)
788
+ # d0 << 2 # => #<Date: 2001-01-31>
789
+ # d0 << 1 << 1 # => #<Date: 2001-01-28>
790
+ #
791
+ # d0 = Date.new(2001, 3, 31)
792
+ # d1 = d0 << 1 # => #<Date: 2001-02-28>
793
+ # d2 = d1 << -1 # => #<Date: 2001-03-28>
794
+ #
795
+ def <<: (Integer month) -> Date
796
+
797
+ # <!--
798
+ # rdoc-file=ext/date/date_core.c
799
+ # - self <=> other -> -1, 0, 1 or nil
800
+ # -->
801
+ # Compares `self` and `other`, returning:
802
+ #
803
+ # * <code>-1</code> if `other` is larger.
804
+ # * `0` if the two are equal.
805
+ # * `1` if `other` is smaller.
806
+ # * `nil` if the two are incomparable.
807
+ #
808
+ # Argument `other` may be:
809
+ #
810
+ # * Another Date object:
811
+ #
812
+ # d = Date.new(2022, 7, 27) # => #<Date: 2022-07-27 ((2459788j,0s,0n),+0s,2299161j)>
813
+ # prev_date = d.prev_day # => #<Date: 2022-07-26 ((2459787j,0s,0n),+0s,2299161j)>
814
+ # next_date = d.next_day # => #<Date: 2022-07-28 ((2459789j,0s,0n),+0s,2299161j)>
815
+ # d <=> next_date # => -1
816
+ # d <=> d # => 0
817
+ # d <=> prev_date # => 1
818
+ #
819
+ # * A DateTime object:
820
+ #
821
+ # d <=> DateTime.new(2022, 7, 26) # => 1
822
+ # d <=> DateTime.new(2022, 7, 27) # => 0
823
+ # d <=> DateTime.new(2022, 7, 28) # => -1
824
+ #
825
+ # * A numeric (compares <code>self.ajd</code> to `other`):
826
+ #
827
+ # d <=> 2459788 # => -1
828
+ # d <=> 2459787 # => 1
829
+ # d <=> 2459786 # => 1
830
+ # d <=> d.ajd # => 0
831
+ #
832
+ # * Any other object:
833
+ #
834
+ # d <=> Object.new # => nil
835
+ #
836
+ def <=>: (untyped other) -> Integer?
837
+
838
+ # <!--
839
+ # rdoc-file=ext/date/date_core.c
840
+ # - self === other -> true, false, or nil.
841
+ # -->
842
+ # Returns `true` if `self` and `other` represent the same date, `false` if not,
843
+ # `nil` if the two are not comparable.
844
+ #
845
+ # Argument `other` may be:
846
+ #
847
+ # * Another Date object:
848
+ #
849
+ # d = Date.new(2022, 7, 27) # => #<Date: 2022-07-27 ((2459788j,0s,0n),+0s,2299161j)>
850
+ # prev_date = d.prev_day # => #<Date: 2022-07-26 ((2459787j,0s,0n),+0s,2299161j)>
851
+ # next_date = d.next_day # => #<Date: 2022-07-28 ((2459789j,0s,0n),+0s,2299161j)>
852
+ # d === prev_date # => false
853
+ # d === d # => true
854
+ # d === next_date # => false
855
+ #
856
+ # * A DateTime object:
857
+ #
858
+ # d === DateTime.new(2022, 7, 26) # => false
859
+ # d === DateTime.new(2022, 7, 27) # => true
860
+ # d === DateTime.new(2022, 7, 28) # => false
861
+ #
862
+ # * A numeric (compares <code>self.jd</code> to `other`):
863
+ #
864
+ # d === 2459788 # => true
865
+ # d === 2459787 # => false
866
+ # d === 2459786 # => false
867
+ # d === d.jd # => true
868
+ #
869
+ # * An object not comparable:
870
+ #
871
+ # d === Object.new # => nil
872
+ #
873
+ def ===: (Date other) -> bool
874
+
875
+ # <!--
876
+ # rdoc-file=ext/date/date_core.c
877
+ # - d >> n -> new_date
878
+ # -->
879
+ # Returns a new Date object representing the date `n` months later; `n` should
880
+ # be a numeric:
881
+ #
882
+ # (Date.new(2001, 2, 3) >> 1).to_s # => "2001-03-03"
883
+ # (Date.new(2001, 2, 3) >> -2).to_s # => "2000-12-03"
884
+ #
885
+ # When the same day does not exist for the new month, the last day of that month
886
+ # is used instead:
887
+ #
888
+ # (Date.new(2001, 1, 31) >> 1).to_s # => "2001-02-28"
889
+ # (Date.new(2001, 1, 31) >> -4).to_s # => "2000-09-30"
890
+ #
891
+ # This results in the following, possibly unexpected, behaviors:
892
+ #
893
+ # d0 = Date.new(2001, 1, 31)
894
+ # d1 = d0 >> 1 # => #<Date: 2001-02-28>
895
+ # d2 = d1 >> 1 # => #<Date: 2001-03-28>
896
+ #
897
+ # d0 = Date.new(2001, 1, 31)
898
+ # d1 = d0 >> 1 # => #<Date: 2001-02-28>
899
+ # d2 = d1 >> -1 # => #<Date: 2001-01-28>
900
+ #
901
+ def >>: (Integer month) -> Date
902
+
903
+ # <!--
904
+ # rdoc-file=ext/date/date_core.c
905
+ # - d.ajd -> rational
906
+ # -->
907
+ # Returns the astronomical Julian day number. This is a fractional number,
908
+ # which is not adjusted by the offset.
909
+ #
910
+ # DateTime.new(2001,2,3,4,5,6,'+7').ajd #=> (11769328217/4800)
911
+ # DateTime.new(2001,2,2,14,5,6,'-7').ajd #=> (11769328217/4800)
912
+ #
913
+ def ajd: () -> Rational
914
+
915
+ # <!--
916
+ # rdoc-file=ext/date/date_core.c
917
+ # - d.amjd -> rational
918
+ # -->
919
+ # Returns the astronomical modified Julian day number. This is a fractional
920
+ # number, which is not adjusted by the offset.
921
+ #
922
+ # DateTime.new(2001,2,3,4,5,6,'+7').amjd #=> (249325817/4800)
923
+ # DateTime.new(2001,2,2,14,5,6,'-7').amjd #=> (249325817/4800)
924
+ #
925
+ def amjd: () -> Rational
926
+
927
+ # <!--
928
+ # rdoc-file=ext/date/date_core.c
929
+ # - asctime -> string
930
+ # -->
931
+ # Equivalent to #strftime with argument <code>'%a %b %e %T %Y'</code> (or its
932
+ # [shorthand
933
+ # form](rdoc-ref:language/strftime_formatting.rdoc@Shorthand+Conversion+Specifie
934
+ # rs) <code>'%c'</code>):
935
+ #
936
+ # Date.new(2001, 2, 3).asctime # => "Sat Feb 3 00:00:00 2001"
937
+ #
938
+ # See [asctime](https://linux.die.net/man/3/asctime).
939
+ #
940
+ def asctime: () -> String
941
+
942
+ # <!-- rdoc-file=ext/date/date_core.c -->
943
+ # Equivalent to #strftime with argument <code>'%a %b %e %T %Y'</code> (or its
944
+ # [shorthand
945
+ # form](rdoc-ref:language/strftime_formatting.rdoc@Shorthand+Conversion+Specifie
946
+ # rs) <code>'%c'</code>):
947
+ #
948
+ # Date.new(2001, 2, 3).asctime # => "Sat Feb 3 00:00:00 2001"
949
+ #
950
+ # See [asctime](https://linux.die.net/man/3/asctime).
951
+ #
952
+ def ctime: () -> String
953
+
954
+ # <!--
955
+ # rdoc-file=ext/date/date_core.c
956
+ # - cwday -> integer
957
+ # -->
958
+ # Returns the commercial-date weekday index for `self` (see Date.commercial); 1
959
+ # is Monday:
960
+ #
961
+ # Date.new(2001, 2, 3).cwday # => 6
962
+ #
963
+ def cwday: () -> Integer
964
+
965
+ # <!--
966
+ # rdoc-file=ext/date/date_core.c
967
+ # - cweek -> integer
968
+ # -->
969
+ # Returns commercial-date week index for `self` (see Date.commercial):
970
+ #
971
+ # Date.new(2001, 2, 3).cweek # => 5
972
+ #
973
+ def cweek: () -> Integer
974
+
975
+ # <!--
976
+ # rdoc-file=ext/date/date_core.c
977
+ # - cwyear -> integer
978
+ # -->
979
+ # Returns commercial-date year for `self` (see Date.commercial):
980
+ #
981
+ # Date.new(2001, 2, 3).cwyear # => 2001
982
+ # Date.new(2000, 1, 1).cwyear # => 1999
983
+ #
984
+ def cwyear: () -> Integer
985
+
986
+ # <!-- rdoc-file=ext/date/date_core.c -->
987
+ # Returns the day of the month in range (1..31):
988
+ #
989
+ # Date.new(2001, 2, 3).mday # => 3
990
+ #
991
+ def day: () -> Integer
992
+
993
+ # <!--
994
+ # rdoc-file=ext/date/date_core.c
995
+ # - deconstruct_keys(array_of_names_or_nil) -> hash
996
+ # -->
997
+ # Returns a hash of the name/value pairs, to use in pattern matching. Possible
998
+ # keys are: <code>:year</code>, <code>:month</code>, <code>:day</code>,
999
+ # <code>:wday</code>, <code>:yday</code>.
1000
+ #
1001
+ # Possible usages:
1002
+ #
1003
+ # d = Date.new(2022, 10, 5)
1004
+ #
1005
+ # if d in wday: 3, day: ..7 # uses deconstruct_keys underneath
1006
+ # puts "first Wednesday of the month"
1007
+ # end
1008
+ # #=> prints "first Wednesday of the month"
1009
+ #
1010
+ # case d
1011
+ # in year: ...2022
1012
+ # puts "too old"
1013
+ # in month: ..9
1014
+ # puts "quarter 1-3"
1015
+ # in wday: 1..5, month:
1016
+ # puts "working day in month #{month}"
1017
+ # end
1018
+ # #=> prints "working day in month 10"
1019
+ #
1020
+ # Note that deconstruction by pattern can also be combined with class check:
1021
+ #
1022
+ # if d in Date(wday: 3, day: ..7)
1023
+ # puts "first Wednesday of the month"
1024
+ # end
1025
+ #
1026
+ def deconstruct_keys: (Array[Symbol]?) -> Hash[Symbol, Integer]
1027
+
1028
+ # <!--
1029
+ # rdoc-file=ext/date/date_core.c
1030
+ # - downto(min){|date| ... } -> self
1031
+ # -->
1032
+ # Equivalent to #step with arguments `min` and <code>-1</code>.
1033
+ #
1034
+ def downto: (Date min) { (Date) -> untyped } -> Date
1035
+ | (Date min) -> Enumerator[Date, Date]
1036
+
1037
+ # <!--
1038
+ # rdoc-file=ext/date/date_core.c
1039
+ # - england -> new_date
1040
+ # -->
1041
+ # Equivalent to Date#new_start with argument Date::ENGLAND.
1042
+ #
1043
+ def england: () -> Date
1044
+
1045
+ # <!--
1046
+ # rdoc-file=ext/date/date_core.c
1047
+ # - friday? -> true or false
1048
+ # -->
1049
+ # Returns `true` if `self` is a Friday, `false` otherwise.
1050
+ #
1051
+ def friday?: () -> bool
1052
+
1053
+ # <!--
1054
+ # rdoc-file=ext/date/date_core.c
1055
+ # - gregorian -> new_date
1056
+ # -->
1057
+ # Equivalent to Date#new_start with argument Date::GREGORIAN.
1058
+ #
1059
+ def gregorian: () -> Date
1060
+
1061
+ # <!--
1062
+ # rdoc-file=ext/date/date_core.c
1063
+ # - gregorian? -> true or false
1064
+ # -->
1065
+ # Returns `true` if the date is on or after the date of calendar reform, `false`
1066
+ # otherwise:
1067
+ #
1068
+ # Date.new(1582, 10, 15).gregorian? # => true
1069
+ # (Date.new(1582, 10, 15) - 1).gregorian? # => false
1070
+ #
1071
+ def gregorian?: () -> bool
1072
+
1073
+ # <!--
1074
+ # rdoc-file=ext/date/date_core.c
1075
+ # - httpdate -> string
1076
+ # -->
1077
+ # Equivalent to #strftime with argument <code>'%a, %d %b %Y %T GMT'</code>; see
1078
+ # [Formats for Dates and Times](rdoc-ref:language/strftime_formatting.rdoc):
1079
+ #
1080
+ # Date.new(2001, 2, 3).httpdate # => "Sat, 03 Feb 2001 00:00:00 GMT"
1081
+ #
1082
+ def httpdate: () -> String
1083
+
1084
+ # <!--
1085
+ # rdoc-file=ext/date/date_core.c
1086
+ # - inspect -> string
1087
+ # -->
1088
+ # Returns a string representation of `self`:
1089
+ #
1090
+ # Date.new(2001, 2, 3).inspect
1091
+ # # => "#<Date: 2001-02-03 ((2451944j,0s,0n),+0s,2299161j)>"
1092
+ #
1093
+ def inspect: () -> String
1094
+
1095
+ # <!--
1096
+ # rdoc-file=ext/date/date_core.c
1097
+ # - iso8601 -> string
1098
+ # -->
1099
+ # Equivalent to #strftime with argument <code>'%Y-%m-%d'</code> (or its
1100
+ # [shorthand
1101
+ # form](rdoc-ref:language/strftime_formatting.rdoc@Shorthand+Conversion+Specifie
1102
+ # rs) <code>'%F'</code>);
1103
+ #
1104
+ # Date.new(2001, 2, 3).iso8601 # => "2001-02-03"
1105
+ #
1106
+ def iso8601: () -> String
1107
+
1108
+ # <!--
1109
+ # rdoc-file=ext/date/date_core.c
1110
+ # - italy -> new_date
1111
+ # -->
1112
+ # Equivalent to Date#new_start with argument Date::ITALY.
1113
+ #
1114
+ def italy: () -> Date
1115
+
1116
+ # <!--
1117
+ # rdoc-file=ext/date/date_core.c
1118
+ # - d.jd -> integer
1119
+ # -->
1120
+ # Returns the Julian day number. This is a whole number, which is adjusted by
1121
+ # the offset as the local time.
1122
+ #
1123
+ # DateTime.new(2001,2,3,4,5,6,'+7').jd #=> 2451944
1124
+ # DateTime.new(2001,2,3,4,5,6,'-7').jd #=> 2451944
1125
+ #
1126
+ def jd: () -> Integer
1127
+
1128
+ # <!--
1129
+ # rdoc-file=ext/date/date_core.c
1130
+ # - jisx0301 -> string
1131
+ # -->
1132
+ # Returns a string representation of the date in `self` in JIS X 0301 format.
1133
+ #
1134
+ # Date.new(2001, 2, 3).jisx0301 # => "H13.02.03"
1135
+ #
1136
+ def jisx0301: () -> String
1137
+
1138
+ # <!--
1139
+ # rdoc-file=ext/date/date_core.c
1140
+ # - julian -> new_date
1141
+ # -->
1142
+ # Equivalent to Date#new_start with argument Date::JULIAN.
1143
+ #
1144
+ def julian: () -> Date
1145
+
1146
+ # <!--
1147
+ # rdoc-file=ext/date/date_core.c
1148
+ # - d.julian? -> true or false
1149
+ # -->
1150
+ # Returns `true` if the date is before the date of calendar reform, `false`
1151
+ # otherwise:
1152
+ #
1153
+ # (Date.new(1582, 10, 15) - 1).julian? # => true
1154
+ # Date.new(1582, 10, 15).julian? # => false
1155
+ #
1156
+ def julian?: () -> bool
1157
+
1158
+ # <!--
1159
+ # rdoc-file=ext/date/date_core.c
1160
+ # - ld -> integer
1161
+ # -->
1162
+ # Returns the [Lilian day number](https://en.wikipedia.org/wiki/Lilian_date),
1163
+ # which is the number of days since the beginning of the Gregorian calendar,
1164
+ # October 15, 1582.
1165
+ #
1166
+ # Date.new(2001, 2, 3).ld # => 152784
1167
+ #
1168
+ def ld: () -> Integer
1169
+
1170
+ # <!--
1171
+ # rdoc-file=ext/date/date_core.c
1172
+ # - leap? -> true or false
1173
+ # -->
1174
+ # Returns `true` if the year is a leap year, `false` otherwise:
1175
+ #
1176
+ # Date.new(2000).leap? # => true
1177
+ # Date.new(2001).leap? # => false
1178
+ #
1179
+ def leap?: () -> bool
1180
+
1181
+ # <!--
1182
+ # rdoc-file=ext/date/date_core.c
1183
+ # - mday -> integer
1184
+ # -->
1185
+ # Returns the day of the month in range (1..31):
1186
+ #
1187
+ # Date.new(2001, 2, 3).mday # => 3
1188
+ #
1189
+ def mday: () -> Integer
1190
+
1191
+ # <!--
1192
+ # rdoc-file=ext/date/date_core.c
1193
+ # - d.mjd -> integer
1194
+ # -->
1195
+ # Returns the modified Julian day number. This is a whole number, which is
1196
+ # adjusted by the offset as the local time.
1197
+ #
1198
+ # DateTime.new(2001,2,3,4,5,6,'+7').mjd #=> 51943
1199
+ # DateTime.new(2001,2,3,4,5,6,'-7').mjd #=> 51943
1200
+ #
1201
+ def mjd: () -> Integer
1202
+
1203
+ # <!--
1204
+ # rdoc-file=ext/date/date_core.c
1205
+ # - mon -> integer
1206
+ # -->
1207
+ # Returns the month in range (1..12):
1208
+ #
1209
+ # Date.new(2001, 2, 3).mon # => 2
1210
+ #
1211
+ def mon: () -> Integer
1212
+
1213
+ # <!--
1214
+ # rdoc-file=ext/date/date_core.c
1215
+ # - monday? -> true or false
1216
+ # -->
1217
+ # Returns `true` if `self` is a Monday, `false` otherwise.
1218
+ #
1219
+ def monday?: () -> bool
1220
+
1221
+ # <!-- rdoc-file=ext/date/date_core.c -->
1222
+ # Returns the month in range (1..12):
1223
+ #
1224
+ # Date.new(2001, 2, 3).mon # => 2
1225
+ #
1226
+ def month: () -> Integer
1227
+
1228
+ # <!--
1229
+ # rdoc-file=ext/date/date_core.c
1230
+ # - new_start(start = Date::ITALY]) -> new_date
1231
+ # -->
1232
+ # Returns a copy of `self` with the given `start` value:
1233
+ #
1234
+ # d0 = Date.new(2000, 2, 3)
1235
+ # d0.julian? # => false
1236
+ # d1 = d0.new_start(Date::JULIAN)
1237
+ # d1.julian? # => true
1238
+ #
1239
+ # See argument [start](rdoc-ref:language/calendars.rdoc@Argument+start).
1240
+ #
1241
+ def new_start: (?Integer start) -> Date
1242
+
1243
+ # <!--
1244
+ # rdoc-file=ext/date/date_core.c
1245
+ # - d.next -> new_date
1246
+ # -->
1247
+ # Returns a new Date object representing the following day:
1248
+ #
1249
+ # d = Date.new(2001, 2, 3)
1250
+ # d.to_s # => "2001-02-03"
1251
+ # d.next.to_s # => "2001-02-04"
1252
+ #
1253
+ def next: () -> Date
1254
+
1255
+ # <!--
1256
+ # rdoc-file=ext/date/date_core.c
1257
+ # - next_day(n = 1) -> new_date
1258
+ # -->
1259
+ # Equivalent to Date#+ with argument `n`.
1260
+ #
1261
+ def next_day: (?Integer day) -> Date
1262
+
1263
+ # <!--
1264
+ # rdoc-file=ext/date/date_core.c
1265
+ # - next_month(n = 1) -> new_date
1266
+ # -->
1267
+ # Equivalent to #>> with argument `n`.
1268
+ #
1269
+ def next_month: (?Integer month) -> Date
1270
+
1271
+ # <!--
1272
+ # rdoc-file=ext/date/date_core.c
1273
+ # - next_year(n = 1) -> new_date
1274
+ # -->
1275
+ # Equivalent to #>> with argument <code>n * 12</code>.
1276
+ #
1277
+ def next_year: (?Integer year) -> Date
1278
+
1279
+ # <!--
1280
+ # rdoc-file=ext/date/date_core.c
1281
+ # - prev_day(n = 1) -> new_date
1282
+ # -->
1283
+ # Equivalent to Date#- with argument `n`.
1284
+ #
1285
+ def prev_day: (?Integer day) -> Date
1286
+
1287
+ # <!--
1288
+ # rdoc-file=ext/date/date_core.c
1289
+ # - prev_month(n = 1) -> new_date
1290
+ # -->
1291
+ # Equivalent to #<< with argument `n`.
1292
+ #
1293
+ def prev_month: (?Integer month) -> Date
1294
+
1295
+ # <!--
1296
+ # rdoc-file=ext/date/date_core.c
1297
+ # - prev_year(n = 1) -> new_date
1298
+ # -->
1299
+ # Equivalent to #<< with argument <code>n * 12</code>.
1300
+ #
1301
+ def prev_year: (?Integer year) -> Date
1302
+
1303
+ # <!--
1304
+ # rdoc-file=ext/date/date_core.c
1305
+ # - rfc2822 -> string
1306
+ # -->
1307
+ # Equivalent to #strftime with argument <code>'%a, %-d %b %Y %T %z'</code>; see
1308
+ # [Formats for Dates and Times](rdoc-ref:language/strftime_formatting.rdoc):
1309
+ #
1310
+ # Date.new(2001, 2, 3).rfc2822 # => "Sat, 3 Feb 2001 00:00:00 +0000"
1311
+ #
1312
+ def rfc2822: () -> String
1313
+
1314
+ # <!--
1315
+ # rdoc-file=ext/date/date_core.c
1316
+ # - rfc3339 -> string
1317
+ # -->
1318
+ # Equivalent to #strftime with argument <code>'%FT%T%:z'</code>; see [Formats
1319
+ # for Dates and Times](rdoc-ref:language/strftime_formatting.rdoc):
1320
+ #
1321
+ # Date.new(2001, 2, 3).rfc3339 # => "2001-02-03T00:00:00+00:00"
1322
+ #
1323
+ def rfc3339: () -> String
1324
+
1325
+ # <!-- rdoc-file=ext/date/date_core.c -->
1326
+ # Returns a new Date object with values parsed from `string`, which should be a
1327
+ # valid [RFC 2822 date
1328
+ # format](rdoc-ref:language/strftime_formatting.rdoc@RFC+2822+Format):
1329
+ #
1330
+ # d = Date.new(2001, 2, 3)
1331
+ # s = d.rfc2822 # => "Sat, 3 Feb 2001 00:00:00 +0000"
1332
+ # Date.rfc2822(s) # => #<Date: 2001-02-03>
1333
+ #
1334
+ # See:
1335
+ #
1336
+ # * Argument [start](rdoc-ref:language/calendars.rdoc@Argument+start).
1337
+ # * Argument [limit](rdoc-ref:Date@Argument+limit).
1338
+ #
1339
+ # Related: Date._rfc2822 (returns a hash).
1340
+ #
1341
+ def rfc822: () -> String
1342
+
1343
+ # <!--
1344
+ # rdoc-file=ext/date/date_core.c
1345
+ # - saturday? -> true or false
1346
+ # -->
1347
+ # Returns `true` if `self` is a Saturday, `false` otherwise.
1348
+ #
1349
+ def saturday?: () -> bool
1350
+
1351
+ # <!--
1352
+ # rdoc-file=ext/date/date_core.c
1353
+ # - start -> float
1354
+ # -->
1355
+ # Returns the Julian start date for calendar reform; if not an infinity, the
1356
+ # returned value is suitable for passing to Date#jd:
1357
+ #
1358
+ # d = Date.new(2001, 2, 3, Date::ITALY)
1359
+ # s = d.start # => 2299161.0
1360
+ # Date.jd(s).to_s # => "1582-10-15"
1361
+ #
1362
+ # d = Date.new(2001, 2, 3, Date::ENGLAND)
1363
+ # s = d.start # => 2361222.0
1364
+ # Date.jd(s).to_s # => "1752-09-14"
1365
+ #
1366
+ # Date.new(2001, 2, 3, Date::GREGORIAN).start # => -Infinity
1367
+ # Date.new(2001, 2, 3, Date::JULIAN).start # => Infinity
1368
+ #
1369
+ # See argument [start](rdoc-ref:language/calendars.rdoc@Argument+start).
1370
+ #
1371
+ def start: () -> Float
1372
+
1373
+ # <!--
1374
+ # rdoc-file=ext/date/date_core.c
1375
+ # - step(limit, step = 1){|date| ... } -> self
1376
+ # -->
1377
+ # Calls the block with specified dates; returns `self`.
1378
+ #
1379
+ # * The first `date` is `self`.
1380
+ # * Each successive `date` is <code>date + step</code>, where `step` is the
1381
+ # numeric step size in days.
1382
+ # * The last date is the last one that is before or equal to `limit`, which
1383
+ # should be a Date object.
1384
+ #
1385
+ # Example:
1386
+ #
1387
+ # limit = Date.new(2001, 12, 31)
1388
+ # Date.new(2001).step(limit){|date| p date.to_s if date.mday == 31 }
1389
+ #
1390
+ # Output:
1391
+ #
1392
+ # "2001-01-31"
1393
+ # "2001-03-31"
1394
+ # "2001-05-31"
1395
+ # "2001-07-31"
1396
+ # "2001-08-31"
1397
+ # "2001-10-31"
1398
+ # "2001-12-31"
1399
+ #
1400
+ # Returns an Enumerator if no block is given.
1401
+ #
1402
+ def step: (Date limit, ?Integer step) { (Date) -> untyped } -> Date
1403
+ | (Date limit, ?Integer step) -> ::Enumerator[Date, Date]
1404
+
1405
+ # <!--
1406
+ # rdoc-file=ext/date/date_core.c
1407
+ # - strftime(format = '%F') -> string
1408
+ # -->
1409
+ # Returns a string representation of the date in `self`, formatted according the
1410
+ # given `format`:
1411
+ #
1412
+ # Date.new(2001, 2, 3).strftime # => "2001-02-03"
1413
+ #
1414
+ # For other formats, see [Formats for Dates and
1415
+ # Times](rdoc-ref:language/strftime_formatting.rdoc).
1416
+ #
1417
+ def strftime: (?String format) -> String
1418
+
1419
+ # <!-- rdoc-file=ext/date/date_core.c -->
1420
+ # Returns a new Date object representing the following day:
1421
+ #
1422
+ # d = Date.new(2001, 2, 3)
1423
+ # d.to_s # => "2001-02-03"
1424
+ # d.next.to_s # => "2001-02-04"
1425
+ #
1426
+ def succ: () -> Date
1427
+
1428
+ # <!--
1429
+ # rdoc-file=ext/date/date_core.c
1430
+ # - sunday? -> true or false
1431
+ # -->
1432
+ # Returns `true` if `self` is a Sunday, `false` otherwise.
1433
+ #
1434
+ def sunday?: () -> bool
1435
+
1436
+ # <!--
1437
+ # rdoc-file=ext/date/date_core.c
1438
+ # - thursday? -> true or false
1439
+ # -->
1440
+ # Returns `true` if `self` is a Thursday, `false` otherwise.
1441
+ #
1442
+ def thursday?: () -> bool
1443
+
1444
+ # <!--
1445
+ # rdoc-file=ext/date/date_core.c
1446
+ # - to_date -> self
1447
+ # -->
1448
+ # Returns `self`.
1449
+ #
1450
+ def to_date: () -> Date
1451
+
1452
+ # <!--
1453
+ # rdoc-file=ext/date/date_core.c
1454
+ # - d.to_datetime -> datetime
1455
+ # -->
1456
+ # Returns a DateTime whose value is the same as `self`:
1457
+ #
1458
+ # Date.new(2001, 2, 3).to_datetime # => #<DateTime: 2001-02-03T00:00:00+00:00>
1459
+ #
1460
+ def to_datetime: () -> DateTime
1461
+
1462
+ # <!--
1463
+ # rdoc-file=ext/date/date_core.c
1464
+ # - to_s -> string
1465
+ # -->
1466
+ # Returns a string representation of the date in `self` in [ISO 8601 extended
1467
+ # date
1468
+ # format](rdoc-ref:language/strftime_formatting.rdoc@ISO+8601+Format+Specificati
1469
+ # ons) (<code>'%Y-%m-%d'</code>):
1470
+ #
1471
+ # Date.new(2001, 2, 3).to_s # => "2001-02-03"
1472
+ #
1473
+ def to_s: () -> String
1474
+
1475
+ # <!--
1476
+ # rdoc-file=ext/date/date_core.c
1477
+ # - to_time -> time
1478
+ # -->
1479
+ # Returns a new Time object with the same value as `self`; if `self` is a Julian
1480
+ # date, derives its Gregorian date for conversion to the Time object:
1481
+ #
1482
+ # Date.new(2001, 2, 3).to_time # => 2001-02-03 00:00:00 -0600
1483
+ # Date.new(2001, 2, 3, Date::JULIAN).to_time # => 2001-02-16 00:00:00 -0600
1484
+ #
1485
+ def to_time: () -> Time
1486
+
1487
+ # <!--
1488
+ # rdoc-file=ext/date/date_core.c
1489
+ # - tuesday? -> true or false
1490
+ # -->
1491
+ # Returns `true` if `self` is a Tuesday, `false` otherwise.
1492
+ #
1493
+ def tuesday?: () -> bool
1494
+
1495
+ # <!--
1496
+ # rdoc-file=ext/date/date_core.c
1497
+ # - upto(max){|date| ... } -> self
1498
+ # -->
1499
+ # Equivalent to #step with arguments `max` and `1`.
1500
+ #
1501
+ def upto: (Date max) { (Date) -> untyped } -> Date
1502
+ | (Date max) -> ::Enumerator[Date, Date]
1503
+
1504
+ # <!--
1505
+ # rdoc-file=ext/date/date_core.c
1506
+ # - wday -> integer
1507
+ # -->
1508
+ # Returns the day of week in range (0..6); Sunday is 0:
1509
+ #
1510
+ # Date.new(2001, 2, 3).wday # => 6
1511
+ #
1512
+ def wday: () -> Integer
1513
+
1514
+ # <!--
1515
+ # rdoc-file=ext/date/date_core.c
1516
+ # - wednesday? -> true or false
1517
+ # -->
1518
+ # Returns `true` if `self` is a Wednesday, `false` otherwise.
1519
+ #
1520
+ def wednesday?: () -> bool
1521
+
1522
+ # <!-- rdoc-file=ext/date/date_core.c -->
1523
+ # Equivalent to #strftime with argument <code>'%Y-%m-%d'</code> (or its
1524
+ # [shorthand
1525
+ # form](rdoc-ref:language/strftime_formatting.rdoc@Shorthand+Conversion+Specifie
1526
+ # rs) <code>'%F'</code>);
1527
+ #
1528
+ # Date.new(2001, 2, 3).iso8601 # => "2001-02-03"
1529
+ #
1530
+ def xmlschema: () -> String
1531
+
1532
+ # <!--
1533
+ # rdoc-file=ext/date/date_core.c
1534
+ # - yday -> integer
1535
+ # -->
1536
+ # Returns the day of the year, in range (1..366):
1537
+ #
1538
+ # Date.new(2001, 2, 3).yday # => 34
1539
+ #
1540
+ def yday: () -> Integer
1541
+
1542
+ # <!--
1543
+ # rdoc-file=ext/date/date_core.c
1544
+ # - year -> integer
1545
+ # -->
1546
+ # Returns the year:
1547
+ #
1548
+ # Date.new(2001, 2, 3).year # => 2001
1549
+ # (Date.new(1, 1, 1) - 1).year # => 0
1550
+ #
1551
+ def year: () -> Integer
1552
+ end
1553
+
1554
+ # <!-- rdoc-file=ext/date/date_core.c -->
1555
+ # An array of strings of abbreviated day names in English. The first is "Sun".
1556
+ #
1557
+ Date::ABBR_DAYNAMES: Array[String]
1558
+
1559
+ # <!-- rdoc-file=ext/date/date_core.c -->
1560
+ # An array of strings of abbreviated month names in English. The first element
1561
+ # is nil.
1562
+ #
1563
+ Date::ABBR_MONTHNAMES: Array[String?]
1564
+
1565
+ # <!-- rdoc-file=ext/date/date_core.c -->
1566
+ # An array of strings of the full names of days of the week in English. The
1567
+ # first is "Sunday".
1568
+ #
1569
+ Date::DAYNAMES: Array[String]
1570
+
1571
+ # <!-- rdoc-file=ext/date/date_core.c -->
1572
+ # The Julian day number of the day of calendar reform for England and her
1573
+ # colonies.
1574
+ #
1575
+ Date::ENGLAND: Integer
1576
+
1577
+ # <!-- rdoc-file=ext/date/date_core.c -->
1578
+ # The Julian day number of the day of calendar reform for the proleptic
1579
+ # Gregorian calendar.
1580
+ #
1581
+ Date::GREGORIAN: Integer
1582
+
1583
+ # <!-- rdoc-file=ext/date/date_core.c -->
1584
+ # The Julian day number of the day of calendar reform for Italy and some
1585
+ # catholic countries.
1586
+ #
1587
+ Date::ITALY: Integer
1588
+
1589
+ # <!-- rdoc-file=ext/date/date_core.c -->
1590
+ # The Julian day number of the day of calendar reform for the proleptic Julian
1591
+ # calendar.
1592
+ #
1593
+ Date::JULIAN: Integer
1594
+
1595
+ # <!-- rdoc-file=ext/date/date_core.c -->
1596
+ # An array of strings of full month names in English. The first element is nil.
1597
+ #
1598
+ Date::MONTHNAMES: Array[String?]