rbs-relaxed 3.9.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (484) hide show
  1. checksums.yaml +7 -0
  2. data/.github/dependabot.yml +22 -0
  3. data/.github/workflows/comments.yml +35 -0
  4. data/.github/workflows/dependabot.yml +30 -0
  5. data/.github/workflows/ruby.yml +82 -0
  6. data/.github/workflows/typecheck.yml +38 -0
  7. data/.github/workflows/windows.yml +43 -0
  8. data/.gitignore +23 -0
  9. data/.rubocop.yml +68 -0
  10. data/BSDL +22 -0
  11. data/CHANGELOG.md +1868 -0
  12. data/COPYING +56 -0
  13. data/README.md +203 -0
  14. data/Rakefile +417 -0
  15. data/Steepfile +44 -0
  16. data/config.yml +313 -0
  17. data/core/array.rbs +4062 -0
  18. data/core/basic_object.rbs +375 -0
  19. data/core/binding.rbs +150 -0
  20. data/core/builtin.rbs +277 -0
  21. data/core/class.rbs +220 -0
  22. data/core/comparable.rbs +171 -0
  23. data/core/complex.rbs +786 -0
  24. data/core/constants.rbs +96 -0
  25. data/core/data.rbs +415 -0
  26. data/core/dir.rbs +981 -0
  27. data/core/encoding.rbs +1371 -0
  28. data/core/enumerable.rbs +2405 -0
  29. data/core/enumerator/product.rbs +92 -0
  30. data/core/enumerator.rbs +630 -0
  31. data/core/env.rbs +6 -0
  32. data/core/errno.rbs +673 -0
  33. data/core/errors.rbs +760 -0
  34. data/core/exception.rbs +485 -0
  35. data/core/false_class.rbs +82 -0
  36. data/core/fiber.rbs +550 -0
  37. data/core/fiber_error.rbs +11 -0
  38. data/core/file.rbs +2936 -0
  39. data/core/file_test.rbs +331 -0
  40. data/core/float.rbs +1151 -0
  41. data/core/gc.rbs +644 -0
  42. data/core/global_variables.rbs +184 -0
  43. data/core/hash.rbs +1861 -0
  44. data/core/integer.rbs +1413 -0
  45. data/core/io/buffer.rbs +984 -0
  46. data/core/io/wait.rbs +70 -0
  47. data/core/io.rbs +3406 -0
  48. data/core/kernel.rbs +3096 -0
  49. data/core/marshal.rbs +207 -0
  50. data/core/match_data.rbs +635 -0
  51. data/core/math.rbs +729 -0
  52. data/core/method.rbs +386 -0
  53. data/core/module.rbs +1704 -0
  54. data/core/nil_class.rbs +209 -0
  55. data/core/numeric.rbs +818 -0
  56. data/core/object.rbs +110 -0
  57. data/core/object_space/weak_key_map.rbs +166 -0
  58. data/core/object_space.rbs +190 -0
  59. data/core/proc.rbs +868 -0
  60. data/core/process.rbs +2296 -0
  61. data/core/ractor.rbs +1068 -0
  62. data/core/random.rbs +237 -0
  63. data/core/range.rbs +1107 -0
  64. data/core/rational.rbs +531 -0
  65. data/core/rb_config.rbs +88 -0
  66. data/core/rbs/unnamed/argf.rbs +1229 -0
  67. data/core/rbs/unnamed/env_class.rbs +1209 -0
  68. data/core/rbs/unnamed/random.rbs +293 -0
  69. data/core/refinement.rbs +59 -0
  70. data/core/regexp.rbs +1930 -0
  71. data/core/ruby_vm.rbs +765 -0
  72. data/core/rubygems/basic_specification.rbs +6 -0
  73. data/core/rubygems/config_file.rbs +38 -0
  74. data/core/rubygems/dependency_installer.rbs +6 -0
  75. data/core/rubygems/errors.rbs +176 -0
  76. data/core/rubygems/installer.rbs +15 -0
  77. data/core/rubygems/path_support.rbs +6 -0
  78. data/core/rubygems/platform.rbs +7 -0
  79. data/core/rubygems/request_set.rbs +49 -0
  80. data/core/rubygems/requirement.rbs +148 -0
  81. data/core/rubygems/rubygems.rbs +1171 -0
  82. data/core/rubygems/source_list.rbs +15 -0
  83. data/core/rubygems/specification.rbs +23 -0
  84. data/core/rubygems/stream_ui.rbs +5 -0
  85. data/core/rubygems/uninstaller.rbs +10 -0
  86. data/core/rubygems/version.rbs +294 -0
  87. data/core/set.rbs +621 -0
  88. data/core/signal.rbs +100 -0
  89. data/core/string.rbs +3583 -0
  90. data/core/struct.rbs +667 -0
  91. data/core/symbol.rbs +475 -0
  92. data/core/thread.rbs +1765 -0
  93. data/core/thread_group.rbs +79 -0
  94. data/core/time.rbs +1762 -0
  95. data/core/trace_point.rbs +477 -0
  96. data/core/true_class.rbs +98 -0
  97. data/core/unbound_method.rbs +329 -0
  98. data/core/warning.rbs +87 -0
  99. data/docs/CONTRIBUTING.md +106 -0
  100. data/docs/architecture.md +110 -0
  101. data/docs/collection.md +192 -0
  102. data/docs/data_and_struct.md +86 -0
  103. data/docs/gem.md +57 -0
  104. data/docs/rbs_by_example.md +309 -0
  105. data/docs/repo.md +125 -0
  106. data/docs/sigs.md +167 -0
  107. data/docs/stdlib.md +147 -0
  108. data/docs/syntax.md +910 -0
  109. data/docs/tools.md +17 -0
  110. data/exe/rbs +7 -0
  111. data/ext/rbs_extension/extconf.rb +15 -0
  112. data/ext/rbs_extension/lexer.c +2728 -0
  113. data/ext/rbs_extension/lexer.h +179 -0
  114. data/ext/rbs_extension/lexer.re +147 -0
  115. data/ext/rbs_extension/lexstate.c +175 -0
  116. data/ext/rbs_extension/location.c +325 -0
  117. data/ext/rbs_extension/location.h +85 -0
  118. data/ext/rbs_extension/main.c +33 -0
  119. data/ext/rbs_extension/parser.c +2973 -0
  120. data/ext/rbs_extension/parser.h +18 -0
  121. data/ext/rbs_extension/parserstate.c +397 -0
  122. data/ext/rbs_extension/parserstate.h +163 -0
  123. data/ext/rbs_extension/rbs_extension.h +31 -0
  124. data/ext/rbs_extension/unescape.c +32 -0
  125. data/goodcheck.yml +91 -0
  126. data/include/rbs/constants.h +82 -0
  127. data/include/rbs/ruby_objs.h +72 -0
  128. data/include/rbs/util/rbs_constant_pool.h +219 -0
  129. data/include/rbs.h +7 -0
  130. data/lib/rbs/ancestor_graph.rb +92 -0
  131. data/lib/rbs/annotate/annotations.rb +199 -0
  132. data/lib/rbs/annotate/formatter.rb +92 -0
  133. data/lib/rbs/annotate/rdoc_annotator.rb +400 -0
  134. data/lib/rbs/annotate/rdoc_source.rb +131 -0
  135. data/lib/rbs/annotate.rb +8 -0
  136. data/lib/rbs/ast/annotation.rb +29 -0
  137. data/lib/rbs/ast/comment.rb +29 -0
  138. data/lib/rbs/ast/declarations.rb +467 -0
  139. data/lib/rbs/ast/directives.rb +49 -0
  140. data/lib/rbs/ast/members.rb +451 -0
  141. data/lib/rbs/ast/type_param.rb +225 -0
  142. data/lib/rbs/ast/visitor.rb +137 -0
  143. data/lib/rbs/buffer.rb +67 -0
  144. data/lib/rbs/builtin_names.rb +58 -0
  145. data/lib/rbs/cli/colored_io.rb +48 -0
  146. data/lib/rbs/cli/diff.rb +83 -0
  147. data/lib/rbs/cli/validate.rb +357 -0
  148. data/lib/rbs/cli.rb +1223 -0
  149. data/lib/rbs/collection/cleaner.rb +38 -0
  150. data/lib/rbs/collection/config/lockfile.rb +92 -0
  151. data/lib/rbs/collection/config/lockfile_generator.rb +218 -0
  152. data/lib/rbs/collection/config.rb +81 -0
  153. data/lib/rbs/collection/installer.rb +32 -0
  154. data/lib/rbs/collection/sources/base.rb +14 -0
  155. data/lib/rbs/collection/sources/git.rb +258 -0
  156. data/lib/rbs/collection/sources/local.rb +81 -0
  157. data/lib/rbs/collection/sources/rubygems.rb +48 -0
  158. data/lib/rbs/collection/sources/stdlib.rb +50 -0
  159. data/lib/rbs/collection/sources.rb +38 -0
  160. data/lib/rbs/collection.rb +16 -0
  161. data/lib/rbs/constant.rb +28 -0
  162. data/lib/rbs/definition.rb +401 -0
  163. data/lib/rbs/definition_builder/ancestor_builder.rb +620 -0
  164. data/lib/rbs/definition_builder/method_builder.rb +254 -0
  165. data/lib/rbs/definition_builder.rb +845 -0
  166. data/lib/rbs/diff.rb +125 -0
  167. data/lib/rbs/environment/use_map.rb +77 -0
  168. data/lib/rbs/environment.rb +829 -0
  169. data/lib/rbs/environment_loader.rb +173 -0
  170. data/lib/rbs/environment_walker.rb +155 -0
  171. data/lib/rbs/errors.rb +645 -0
  172. data/lib/rbs/factory.rb +18 -0
  173. data/lib/rbs/file_finder.rb +28 -0
  174. data/lib/rbs/location_aux.rb +138 -0
  175. data/lib/rbs/locator.rb +243 -0
  176. data/lib/rbs/method_type.rb +143 -0
  177. data/lib/rbs/namespace.rb +125 -0
  178. data/lib/rbs/parser/lex_result.rb +15 -0
  179. data/lib/rbs/parser/token.rb +23 -0
  180. data/lib/rbs/parser_aux.rb +114 -0
  181. data/lib/rbs/prototype/helpers.rb +140 -0
  182. data/lib/rbs/prototype/node_usage.rb +99 -0
  183. data/lib/rbs/prototype/rb.rb +840 -0
  184. data/lib/rbs/prototype/rbi.rb +641 -0
  185. data/lib/rbs/prototype/runtime/helpers.rb +59 -0
  186. data/lib/rbs/prototype/runtime/reflection.rb +19 -0
  187. data/lib/rbs/prototype/runtime/value_object_generator.rb +279 -0
  188. data/lib/rbs/prototype/runtime.rb +667 -0
  189. data/lib/rbs/repository.rb +127 -0
  190. data/lib/rbs/resolver/constant_resolver.rb +219 -0
  191. data/lib/rbs/resolver/type_name_resolver.rb +91 -0
  192. data/lib/rbs/sorter.rb +198 -0
  193. data/lib/rbs/substitution.rb +83 -0
  194. data/lib/rbs/subtractor.rb +201 -0
  195. data/lib/rbs/test/errors.rb +80 -0
  196. data/lib/rbs/test/guaranteed.rb +30 -0
  197. data/lib/rbs/test/hook.rb +212 -0
  198. data/lib/rbs/test/observer.rb +19 -0
  199. data/lib/rbs/test/setup.rb +84 -0
  200. data/lib/rbs/test/setup_helper.rb +50 -0
  201. data/lib/rbs/test/tester.rb +167 -0
  202. data/lib/rbs/test/type_check.rb +435 -0
  203. data/lib/rbs/test.rb +112 -0
  204. data/lib/rbs/type_alias_dependency.rb +100 -0
  205. data/lib/rbs/type_alias_regularity.rb +126 -0
  206. data/lib/rbs/type_name.rb +109 -0
  207. data/lib/rbs/types.rb +1596 -0
  208. data/lib/rbs/unit_test/convertibles.rb +176 -0
  209. data/lib/rbs/unit_test/spy.rb +138 -0
  210. data/lib/rbs/unit_test/type_assertions.rb +347 -0
  211. data/lib/rbs/unit_test/with_aliases.rb +143 -0
  212. data/lib/rbs/unit_test.rb +6 -0
  213. data/lib/rbs/validator.rb +186 -0
  214. data/lib/rbs/variance_calculator.rb +189 -0
  215. data/lib/rbs/vendorer.rb +71 -0
  216. data/lib/rbs/version.rb +5 -0
  217. data/lib/rbs/writer.rb +424 -0
  218. data/lib/rbs.rb +94 -0
  219. data/lib/rdoc/discover.rb +20 -0
  220. data/lib/rdoc_plugin/parser.rb +163 -0
  221. data/rbs-relaxed.gemspec +48 -0
  222. data/schema/annotation.json +14 -0
  223. data/schema/comment.json +26 -0
  224. data/schema/decls.json +326 -0
  225. data/schema/function.json +87 -0
  226. data/schema/location.json +56 -0
  227. data/schema/members.json +266 -0
  228. data/schema/methodType.json +50 -0
  229. data/schema/typeParam.json +36 -0
  230. data/schema/types.json +317 -0
  231. data/sig/ancestor_builder.rbs +163 -0
  232. data/sig/ancestor_graph.rbs +60 -0
  233. data/sig/annotate/annotations.rbs +102 -0
  234. data/sig/annotate/formatter.rbs +24 -0
  235. data/sig/annotate/rdoc_annotater.rbs +82 -0
  236. data/sig/annotate/rdoc_source.rbs +30 -0
  237. data/sig/annotation.rbs +27 -0
  238. data/sig/buffer.rbs +32 -0
  239. data/sig/builtin_names.rbs +44 -0
  240. data/sig/cli/colored_io.rbs +15 -0
  241. data/sig/cli/diff.rbs +21 -0
  242. data/sig/cli/validate.rbs +43 -0
  243. data/sig/cli.rbs +87 -0
  244. data/sig/collection/cleaner.rbs +13 -0
  245. data/sig/collection/config/lockfile.rbs +74 -0
  246. data/sig/collection/config/lockfile_generator.rbs +66 -0
  247. data/sig/collection/config.rbs +46 -0
  248. data/sig/collection/installer.rbs +17 -0
  249. data/sig/collection/sources.rbs +214 -0
  250. data/sig/collection.rbs +4 -0
  251. data/sig/comment.rbs +26 -0
  252. data/sig/constant.rbs +21 -0
  253. data/sig/declarations.rbs +267 -0
  254. data/sig/definition.rbs +173 -0
  255. data/sig/definition_builder.rbs +165 -0
  256. data/sig/diff.rbs +28 -0
  257. data/sig/directives.rbs +77 -0
  258. data/sig/environment.rbs +279 -0
  259. data/sig/environment_loader.rbs +111 -0
  260. data/sig/environment_walker.rbs +65 -0
  261. data/sig/errors.rbs +405 -0
  262. data/sig/factory.rbs +5 -0
  263. data/sig/file_finder.rbs +28 -0
  264. data/sig/location.rbs +110 -0
  265. data/sig/locator.rbs +58 -0
  266. data/sig/manifest.yaml +7 -0
  267. data/sig/members.rbs +258 -0
  268. data/sig/method_builder.rbs +84 -0
  269. data/sig/method_types.rbs +58 -0
  270. data/sig/namespace.rbs +146 -0
  271. data/sig/parser.rbs +100 -0
  272. data/sig/prototype/helpers.rbs +27 -0
  273. data/sig/prototype/node_usage.rbs +20 -0
  274. data/sig/prototype/rb.rbs +96 -0
  275. data/sig/prototype/rbi.rbs +75 -0
  276. data/sig/prototype/runtime.rbs +182 -0
  277. data/sig/rbs.rbs +21 -0
  278. data/sig/rdoc/rbs.rbs +67 -0
  279. data/sig/repository.rbs +85 -0
  280. data/sig/resolver/constant_resolver.rbs +92 -0
  281. data/sig/resolver/context.rbs +34 -0
  282. data/sig/resolver/type_name_resolver.rbs +35 -0
  283. data/sig/shims/bundler.rbs +38 -0
  284. data/sig/shims/enumerable.rbs +5 -0
  285. data/sig/shims/rubygems.rbs +19 -0
  286. data/sig/sorter.rbs +41 -0
  287. data/sig/substitution.rbs +48 -0
  288. data/sig/subtractor.rbs +37 -0
  289. data/sig/test/errors.rbs +52 -0
  290. data/sig/test/guranteed.rbs +9 -0
  291. data/sig/test/type_check.rbs +19 -0
  292. data/sig/test.rbs +82 -0
  293. data/sig/type_alias_dependency.rbs +53 -0
  294. data/sig/type_alias_regularity.rbs +98 -0
  295. data/sig/type_param.rbs +110 -0
  296. data/sig/typename.rbs +79 -0
  297. data/sig/types.rbs +579 -0
  298. data/sig/unit_test/convertibles.rbs +154 -0
  299. data/sig/unit_test/spy.rbs +30 -0
  300. data/sig/unit_test/type_assertions.rbs +196 -0
  301. data/sig/unit_test/with_aliases.rbs +136 -0
  302. data/sig/use_map.rbs +35 -0
  303. data/sig/util.rbs +9 -0
  304. data/sig/validator.rbs +63 -0
  305. data/sig/variance_calculator.rbs +87 -0
  306. data/sig/vendorer.rbs +51 -0
  307. data/sig/version.rbs +3 -0
  308. data/sig/visitor.rbs +47 -0
  309. data/sig/writer.rbs +127 -0
  310. data/src/constants.c +153 -0
  311. data/src/ruby_objs.c +795 -0
  312. data/src/util/rbs_constant_pool.c +342 -0
  313. data/stdlib/abbrev/0/abbrev.rbs +66 -0
  314. data/stdlib/abbrev/0/array.rbs +26 -0
  315. data/stdlib/base64/0/base64.rbs +355 -0
  316. data/stdlib/benchmark/0/benchmark.rbs +452 -0
  317. data/stdlib/bigdecimal/0/big_decimal.rbs +1629 -0
  318. data/stdlib/bigdecimal-math/0/big_math.rbs +119 -0
  319. data/stdlib/bigdecimal-math/0/manifest.yaml +2 -0
  320. data/stdlib/cgi/0/core.rbs +1285 -0
  321. data/stdlib/cgi/0/manifest.yaml +3 -0
  322. data/stdlib/coverage/0/coverage.rbs +263 -0
  323. data/stdlib/csv/0/csv.rbs +3776 -0
  324. data/stdlib/csv/0/manifest.yaml +3 -0
  325. data/stdlib/date/0/date.rbs +1585 -0
  326. data/stdlib/date/0/date_time.rbs +616 -0
  327. data/stdlib/date/0/time.rbs +26 -0
  328. data/stdlib/dbm/0/dbm.rbs +421 -0
  329. data/stdlib/delegate/0/delegator.rbs +184 -0
  330. data/stdlib/delegate/0/kernel.rbs +47 -0
  331. data/stdlib/delegate/0/simple_delegator.rbs +96 -0
  332. data/stdlib/did_you_mean/0/did_you_mean.rbs +343 -0
  333. data/stdlib/digest/0/digest.rbs +577 -0
  334. data/stdlib/erb/0/erb.rbs +532 -0
  335. data/stdlib/etc/0/etc.rbs +865 -0
  336. data/stdlib/fileutils/0/fileutils.rbs +1734 -0
  337. data/stdlib/find/0/find.rbs +49 -0
  338. data/stdlib/forwardable/0/forwardable.rbs +268 -0
  339. data/stdlib/io-console/0/io-console.rbs +414 -0
  340. data/stdlib/ipaddr/0/ipaddr.rbs +428 -0
  341. data/stdlib/json/0/json.rbs +1916 -0
  342. data/stdlib/kconv/0/kconv.rbs +166 -0
  343. data/stdlib/logger/0/formatter.rbs +45 -0
  344. data/stdlib/logger/0/log_device.rbs +100 -0
  345. data/stdlib/logger/0/logger.rbs +796 -0
  346. data/stdlib/logger/0/manifest.yaml +2 -0
  347. data/stdlib/logger/0/period.rbs +17 -0
  348. data/stdlib/logger/0/severity.rbs +34 -0
  349. data/stdlib/minitest/0/kernel.rbs +42 -0
  350. data/stdlib/minitest/0/minitest/abstract_reporter.rbs +52 -0
  351. data/stdlib/minitest/0/minitest/assertion.rbs +17 -0
  352. data/stdlib/minitest/0/minitest/assertions.rbs +590 -0
  353. data/stdlib/minitest/0/minitest/backtrace_filter.rbs +23 -0
  354. data/stdlib/minitest/0/minitest/bench_spec.rbs +102 -0
  355. data/stdlib/minitest/0/minitest/benchmark.rbs +259 -0
  356. data/stdlib/minitest/0/minitest/composite_reporter.rbs +25 -0
  357. data/stdlib/minitest/0/minitest/compress.rbs +13 -0
  358. data/stdlib/minitest/0/minitest/error_on_warning.rbs +3 -0
  359. data/stdlib/minitest/0/minitest/expectation.rbs +2 -0
  360. data/stdlib/minitest/0/minitest/expectations.rbs +21 -0
  361. data/stdlib/minitest/0/minitest/guard.rbs +64 -0
  362. data/stdlib/minitest/0/minitest/mock.rbs +64 -0
  363. data/stdlib/minitest/0/minitest/parallel/executor.rbs +46 -0
  364. data/stdlib/minitest/0/minitest/parallel/test/class_methods.rbs +5 -0
  365. data/stdlib/minitest/0/minitest/parallel/test.rbs +3 -0
  366. data/stdlib/minitest/0/minitest/parallel.rbs +2 -0
  367. data/stdlib/minitest/0/minitest/pride_io.rbs +62 -0
  368. data/stdlib/minitest/0/minitest/pride_lol.rbs +19 -0
  369. data/stdlib/minitest/0/minitest/progress_reporter.rbs +11 -0
  370. data/stdlib/minitest/0/minitest/reportable.rbs +53 -0
  371. data/stdlib/minitest/0/minitest/reporter.rbs +5 -0
  372. data/stdlib/minitest/0/minitest/result.rbs +28 -0
  373. data/stdlib/minitest/0/minitest/runnable.rbs +163 -0
  374. data/stdlib/minitest/0/minitest/skip.rbs +6 -0
  375. data/stdlib/minitest/0/minitest/spec/dsl/instance_methods.rbs +48 -0
  376. data/stdlib/minitest/0/minitest/spec/dsl.rbs +129 -0
  377. data/stdlib/minitest/0/minitest/spec.rbs +11 -0
  378. data/stdlib/minitest/0/minitest/statistics_reporter.rbs +81 -0
  379. data/stdlib/minitest/0/minitest/summary_reporter.rbs +18 -0
  380. data/stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs +92 -0
  381. data/stdlib/minitest/0/minitest/test.rbs +69 -0
  382. data/stdlib/minitest/0/minitest/unexpected_error.rbs +12 -0
  383. data/stdlib/minitest/0/minitest/unexpected_warning.rbs +6 -0
  384. data/stdlib/minitest/0/minitest/unit/test_case.rbs +3 -0
  385. data/stdlib/minitest/0/minitest/unit.rbs +4 -0
  386. data/stdlib/minitest/0/minitest.rbs +115 -0
  387. data/stdlib/monitor/0/monitor.rbs +363 -0
  388. data/stdlib/mutex_m/0/mutex_m.rbs +104 -0
  389. data/stdlib/net-http/0/manifest.yaml +3 -0
  390. data/stdlib/net-http/0/net-http.rbs +5552 -0
  391. data/stdlib/net-protocol/0/manifest.yaml +2 -0
  392. data/stdlib/net-protocol/0/net-protocol.rbs +56 -0
  393. data/stdlib/net-smtp/0/manifest.yaml +2 -0
  394. data/stdlib/net-smtp/0/net-smtp.rbs +55 -0
  395. data/stdlib/nkf/0/nkf.rbs +402 -0
  396. data/stdlib/objspace/0/objspace.rbs +487 -0
  397. data/stdlib/observable/0/observable.rbs +217 -0
  398. data/stdlib/open-uri/0/manifest.yaml +4 -0
  399. data/stdlib/open-uri/0/open-uri.rbs +393 -0
  400. data/stdlib/open3/0/open3.rbs +147 -0
  401. data/stdlib/openssl/0/manifest.yaml +3 -0
  402. data/stdlib/openssl/0/openssl.rbs +12113 -0
  403. data/stdlib/optparse/0/optparse.rbs +1725 -0
  404. data/stdlib/pathname/0/pathname.rbs +1406 -0
  405. data/stdlib/pp/0/manifest.yaml +2 -0
  406. data/stdlib/pp/0/pp.rbs +300 -0
  407. data/stdlib/prettyprint/0/prettyprint.rbs +383 -0
  408. data/stdlib/pstore/0/pstore.rbs +603 -0
  409. data/stdlib/psych/0/core_ext.rbs +12 -0
  410. data/stdlib/psych/0/dbm.rbs +237 -0
  411. data/stdlib/psych/0/manifest.yaml +3 -0
  412. data/stdlib/psych/0/psych.rbs +402 -0
  413. data/stdlib/psych/0/store.rbs +59 -0
  414. data/stdlib/pty/0/pty.rbs +237 -0
  415. data/stdlib/rdoc/0/code_object.rbs +51 -0
  416. data/stdlib/rdoc/0/comment.rbs +59 -0
  417. data/stdlib/rdoc/0/context.rbs +153 -0
  418. data/stdlib/rdoc/0/markup.rbs +117 -0
  419. data/stdlib/rdoc/0/parser.rbs +56 -0
  420. data/stdlib/rdoc/0/rdoc.rbs +391 -0
  421. data/stdlib/rdoc/0/ri.rbs +17 -0
  422. data/stdlib/rdoc/0/store.rbs +48 -0
  423. data/stdlib/rdoc/0/top_level.rbs +97 -0
  424. data/stdlib/resolv/0/manifest.yaml +3 -0
  425. data/stdlib/resolv/0/resolv.rbs +1830 -0
  426. data/stdlib/ripper/0/ripper.rbs +1648 -0
  427. data/stdlib/securerandom/0/securerandom.rbs +62 -0
  428. data/stdlib/shellwords/0/shellwords.rbs +229 -0
  429. data/stdlib/singleton/0/singleton.rbs +131 -0
  430. data/stdlib/socket/0/addrinfo.rbs +666 -0
  431. data/stdlib/socket/0/basic_socket.rbs +590 -0
  432. data/stdlib/socket/0/constants.rbs +2295 -0
  433. data/stdlib/socket/0/ip_socket.rbs +92 -0
  434. data/stdlib/socket/0/socket.rbs +4157 -0
  435. data/stdlib/socket/0/socket_error.rbs +5 -0
  436. data/stdlib/socket/0/tcp_server.rbs +192 -0
  437. data/stdlib/socket/0/tcp_socket.rbs +79 -0
  438. data/stdlib/socket/0/udp_socket.rbs +133 -0
  439. data/stdlib/socket/0/unix_server.rbs +169 -0
  440. data/stdlib/socket/0/unix_socket.rbs +172 -0
  441. data/stdlib/stringio/0/stringio.rbs +567 -0
  442. data/stdlib/strscan/0/string_scanner.rbs +1627 -0
  443. data/stdlib/tempfile/0/tempfile.rbs +479 -0
  444. data/stdlib/time/0/time.rbs +432 -0
  445. data/stdlib/timeout/0/timeout.rbs +81 -0
  446. data/stdlib/tmpdir/0/tmpdir.rbs +69 -0
  447. data/stdlib/tsort/0/cyclic.rbs +5 -0
  448. data/stdlib/tsort/0/interfaces.rbs +20 -0
  449. data/stdlib/tsort/0/tsort.rbs +409 -0
  450. data/stdlib/uri/0/common.rbs +582 -0
  451. data/stdlib/uri/0/file.rbs +118 -0
  452. data/stdlib/uri/0/ftp.rbs +13 -0
  453. data/stdlib/uri/0/generic.rbs +1108 -0
  454. data/stdlib/uri/0/http.rbs +104 -0
  455. data/stdlib/uri/0/https.rbs +14 -0
  456. data/stdlib/uri/0/ldap.rbs +230 -0
  457. data/stdlib/uri/0/ldaps.rbs +14 -0
  458. data/stdlib/uri/0/mailto.rbs +92 -0
  459. data/stdlib/uri/0/rfc2396_parser.rbs +189 -0
  460. data/stdlib/uri/0/rfc3986_parser.rbs +2 -0
  461. data/stdlib/uri/0/ws.rbs +13 -0
  462. data/stdlib/uri/0/wss.rbs +9 -0
  463. data/stdlib/yaml/0/manifest.yaml +2 -0
  464. data/stdlib/yaml/0/yaml.rbs +1 -0
  465. data/stdlib/zlib/0/buf_error.rbs +10 -0
  466. data/stdlib/zlib/0/data_error.rbs +10 -0
  467. data/stdlib/zlib/0/deflate.rbs +210 -0
  468. data/stdlib/zlib/0/error.rbs +20 -0
  469. data/stdlib/zlib/0/gzip_file/crc_error.rbs +12 -0
  470. data/stdlib/zlib/0/gzip_file/error.rbs +23 -0
  471. data/stdlib/zlib/0/gzip_file/length_error.rbs +12 -0
  472. data/stdlib/zlib/0/gzip_file/no_footer.rbs +11 -0
  473. data/stdlib/zlib/0/gzip_file.rbs +156 -0
  474. data/stdlib/zlib/0/gzip_reader.rbs +293 -0
  475. data/stdlib/zlib/0/gzip_writer.rbs +166 -0
  476. data/stdlib/zlib/0/inflate.rbs +180 -0
  477. data/stdlib/zlib/0/mem_error.rbs +10 -0
  478. data/stdlib/zlib/0/need_dict.rbs +13 -0
  479. data/stdlib/zlib/0/stream_end.rbs +11 -0
  480. data/stdlib/zlib/0/stream_error.rbs +11 -0
  481. data/stdlib/zlib/0/version_error.rbs +11 -0
  482. data/stdlib/zlib/0/zlib.rbs +449 -0
  483. data/stdlib/zlib/0/zstream.rbs +200 -0
  484. metadata +532 -0
@@ -0,0 +1,1285 @@
1
+ # <!-- rdoc-file=lib/cgi.rb -->
2
+ # ## Overview
3
+ #
4
+ # The Common Gateway Interface (CGI) is a simple protocol for passing an HTTP
5
+ # request from a web server to a standalone program, and returning the output to
6
+ # the web browser. Basically, a CGI program is called with the parameters of
7
+ # the request passed in either in the environment (GET) or via $stdin (POST),
8
+ # and everything it prints to $stdout is returned to the client.
9
+ #
10
+ # This file holds the CGI class. This class provides functionality for
11
+ # retrieving HTTP request parameters, managing cookies, and generating HTML
12
+ # output.
13
+ #
14
+ # The file CGI::Session provides session management functionality; see that
15
+ # class for more details.
16
+ #
17
+ # See http://www.w3.org/CGI/ for more information on the CGI protocol.
18
+ #
19
+ # ## Introduction
20
+ #
21
+ # CGI is a large class, providing several categories of methods, many of which
22
+ # are mixed in from other modules. Some of the documentation is in this class,
23
+ # some in the modules CGI::QueryExtension and CGI::HtmlExtension. See
24
+ # CGI::Cookie for specific information on handling cookies, and cgi/session.rb
25
+ # (CGI::Session) for information on sessions.
26
+ #
27
+ # For queries, CGI provides methods to get at environmental variables,
28
+ # parameters, cookies, and multipart request data. For responses, CGI provides
29
+ # methods for writing output and generating HTML.
30
+ #
31
+ # Read on for more details. Examples are provided at the bottom.
32
+ #
33
+ # ## Queries
34
+ #
35
+ # The CGI class dynamically mixes in parameter and cookie-parsing functionality,
36
+ # environmental variable access, and support for parsing multipart requests
37
+ # (including uploaded files) from the CGI::QueryExtension module.
38
+ #
39
+ # ### Environmental Variables
40
+ #
41
+ # The standard CGI environmental variables are available as read-only attributes
42
+ # of a CGI object. The following is a list of these variables:
43
+ #
44
+ # AUTH_TYPE HTTP_HOST REMOTE_IDENT
45
+ # CONTENT_LENGTH HTTP_NEGOTIATE REMOTE_USER
46
+ # CONTENT_TYPE HTTP_PRAGMA REQUEST_METHOD
47
+ # GATEWAY_INTERFACE HTTP_REFERER SCRIPT_NAME
48
+ # HTTP_ACCEPT HTTP_USER_AGENT SERVER_NAME
49
+ # HTTP_ACCEPT_CHARSET PATH_INFO SERVER_PORT
50
+ # HTTP_ACCEPT_ENCODING PATH_TRANSLATED SERVER_PROTOCOL
51
+ # HTTP_ACCEPT_LANGUAGE QUERY_STRING SERVER_SOFTWARE
52
+ # HTTP_CACHE_CONTROL REMOTE_ADDR
53
+ # HTTP_FROM REMOTE_HOST
54
+ #
55
+ # For each of these variables, there is a corresponding attribute with the same
56
+ # name, except all lower case and without a preceding HTTP_. `content_length`
57
+ # and `server_port` are integers; the rest are strings.
58
+ #
59
+ # ### Parameters
60
+ #
61
+ # The method #params() returns a hash of all parameters in the request as
62
+ # name/value-list pairs, where the value-list is an Array of one or more values.
63
+ # The CGI object itself also behaves as a hash of parameter names to values,
64
+ # but only returns a single value (as a String) for each parameter name.
65
+ #
66
+ # For instance, suppose the request contains the parameter "favourite_colours"
67
+ # with the multiple values "blue" and "green". The following behavior would
68
+ # occur:
69
+ #
70
+ # cgi.params["favourite_colours"] # => ["blue", "green"]
71
+ # cgi["favourite_colours"] # => "blue"
72
+ #
73
+ # If a parameter does not exist, the former method will return an empty array,
74
+ # the latter an empty string. The simplest way to test for existence of a
75
+ # parameter is by the #has_key? method.
76
+ #
77
+ # ### Cookies
78
+ #
79
+ # HTTP Cookies are automatically parsed from the request. They are available
80
+ # from the #cookies() accessor, which returns a hash from cookie name to
81
+ # CGI::Cookie object.
82
+ #
83
+ # ### Multipart requests
84
+ #
85
+ # If a request's method is POST and its content type is multipart/form-data,
86
+ # then it may contain uploaded files. These are stored by the QueryExtension
87
+ # module in the parameters of the request. The parameter name is the name
88
+ # attribute of the file input field, as usual. However, the value is not a
89
+ # string, but an IO object, either an IOString for small files, or a Tempfile
90
+ # for larger ones. This object also has the additional singleton methods:
91
+ #
92
+ # #local_path()
93
+ # : the path of the uploaded file on the local filesystem
94
+ #
95
+ # #original_filename()
96
+ # : the name of the file on the client computer
97
+ #
98
+ # #content_type()
99
+ # : the content type of the file
100
+ #
101
+ #
102
+ # ## Responses
103
+ #
104
+ # The CGI class provides methods for sending header and content output to the
105
+ # HTTP client, and mixes in methods for programmatic HTML generation from
106
+ # CGI::HtmlExtension and CGI::TagMaker modules. The precise version of HTML to
107
+ # use for HTML generation is specified at object creation time.
108
+ #
109
+ # ### Writing output
110
+ #
111
+ # The simplest way to send output to the HTTP client is using the #out() method.
112
+ # This takes the HTTP headers as a hash parameter, and the body content via a
113
+ # block. The headers can be generated as a string using the #http_header()
114
+ # method. The output stream can be written directly to using the #print()
115
+ # method.
116
+ #
117
+ # ### Generating HTML
118
+ #
119
+ # Each HTML element has a corresponding method for generating that element as a
120
+ # String. The name of this method is the same as that of the element, all
121
+ # lowercase. The attributes of the element are passed in as a hash, and the
122
+ # body as a no-argument block that evaluates to a String. The HTML generation
123
+ # module knows which elements are always empty, and silently drops any passed-in
124
+ # body. It also knows which elements require matching closing tags and which
125
+ # don't. However, it does not know what attributes are legal for which
126
+ # elements.
127
+ #
128
+ # There are also some additional HTML generation methods mixed in from the
129
+ # CGI::HtmlExtension module. These include individual methods for the different
130
+ # types of form inputs, and methods for elements that commonly take particular
131
+ # attributes where the attributes can be directly specified as arguments, rather
132
+ # than via a hash.
133
+ #
134
+ # ### Utility HTML escape and other methods like a function.
135
+ #
136
+ # There are some utility tool defined in cgi/util.rb . And when include, you can
137
+ # use utility methods like a function.
138
+ #
139
+ # ## Examples of use
140
+ #
141
+ # ### Get form values
142
+ #
143
+ # require "cgi"
144
+ # cgi = CGI.new
145
+ # value = cgi['field_name'] # <== value string for 'field_name'
146
+ # # if not 'field_name' included, then return "".
147
+ # fields = cgi.keys # <== array of field names
148
+ #
149
+ # # returns true if form has 'field_name'
150
+ # cgi.has_key?('field_name')
151
+ # cgi.has_key?('field_name')
152
+ # cgi.include?('field_name')
153
+ #
154
+ # CAUTION! `cgi['field_name']` returned an Array with the old cgi.rb(included in
155
+ # Ruby 1.6)
156
+ #
157
+ # ### Get form values as hash
158
+ #
159
+ # require "cgi"
160
+ # cgi = CGI.new
161
+ # params = cgi.params
162
+ #
163
+ # cgi.params is a hash.
164
+ #
165
+ # cgi.params['new_field_name'] = ["value"] # add new param
166
+ # cgi.params['field_name'] = ["new_value"] # change value
167
+ # cgi.params.delete('field_name') # delete param
168
+ # cgi.params.clear # delete all params
169
+ #
170
+ # ### Save form values to file
171
+ #
172
+ # require "pstore"
173
+ # db = PStore.new("query.db")
174
+ # db.transaction do
175
+ # db["params"] = cgi.params
176
+ # end
177
+ #
178
+ # ### Restore form values from file
179
+ #
180
+ # require "pstore"
181
+ # db = PStore.new("query.db")
182
+ # db.transaction do
183
+ # cgi.params = db["params"]
184
+ # end
185
+ #
186
+ # ### Get multipart form values
187
+ #
188
+ # require "cgi"
189
+ # cgi = CGI.new
190
+ # value = cgi['field_name'] # <== value string for 'field_name'
191
+ # value.read # <== body of value
192
+ # value.local_path # <== path to local file of value
193
+ # value.original_filename # <== original filename of value
194
+ # value.content_type # <== content_type of value
195
+ #
196
+ # and value has StringIO or Tempfile class methods.
197
+ #
198
+ # ### Get cookie values
199
+ #
200
+ # require "cgi"
201
+ # cgi = CGI.new
202
+ # values = cgi.cookies['name'] # <== array of 'name'
203
+ # # if not 'name' included, then return [].
204
+ # names = cgi.cookies.keys # <== array of cookie names
205
+ #
206
+ # and cgi.cookies is a hash.
207
+ #
208
+ # ### Get cookie objects
209
+ #
210
+ # require "cgi"
211
+ # cgi = CGI.new
212
+ # for name, cookie in cgi.cookies
213
+ # cookie.expires = Time.now + 30
214
+ # end
215
+ # cgi.out("cookie" => cgi.cookies) {"string"}
216
+ #
217
+ # cgi.cookies # { "name1" => cookie1, "name2" => cookie2, ... }
218
+ #
219
+ # require "cgi"
220
+ # cgi = CGI.new
221
+ # cgi.cookies['name'].expires = Time.now + 30
222
+ # cgi.out("cookie" => cgi.cookies['name']) {"string"}
223
+ #
224
+ # ### Print http header and html string to $DEFAULT_OUTPUT ($>)
225
+ #
226
+ # require "cgi"
227
+ # cgi = CGI.new("html4") # add HTML generation methods
228
+ # cgi.out do
229
+ # cgi.html do
230
+ # cgi.head do
231
+ # cgi.title { "TITLE" }
232
+ # end +
233
+ # cgi.body do
234
+ # cgi.form("ACTION" => "uri") do
235
+ # cgi.p do
236
+ # cgi.textarea("get_text") +
237
+ # cgi.br +
238
+ # cgi.submit
239
+ # end
240
+ # end +
241
+ # cgi.pre do
242
+ # CGI.escapeHTML(
243
+ # "params: #{cgi.params.inspect}\n" +
244
+ # "cookies: #{cgi.cookies.inspect}\n" +
245
+ # ENV.collect do |key, value|
246
+ # "#{key} --> #{value}\n"
247
+ # end.join("")
248
+ # )
249
+ # end
250
+ # end
251
+ # end
252
+ # end
253
+ #
254
+ # # add HTML generation methods
255
+ # CGI.new("html3") # html3.2
256
+ # CGI.new("html4") # html4.01 (Strict)
257
+ # CGI.new("html4Tr") # html4.01 Transitional
258
+ # CGI.new("html4Fr") # html4.01 Frameset
259
+ # CGI.new("html5") # html5
260
+ #
261
+ # ### Some utility methods
262
+ #
263
+ # require 'cgi/util'
264
+ # CGI.escapeHTML('Usage: foo "bar" <baz>')
265
+ #
266
+ # ### Some utility methods like a function
267
+ #
268
+ # require 'cgi/util'
269
+ # include CGI::Util
270
+ # escapeHTML('Usage: foo "bar" <baz>')
271
+ # h('Usage: foo "bar" <baz>') # alias
272
+ #
273
+ class CGI
274
+ include CGI::Util
275
+
276
+ extend CGI::Util
277
+
278
+ # <!--
279
+ # rdoc-file=lib/cgi/core.rb
280
+ # - CGI.new(tag_maker) { block }
281
+ # - CGI.new(options_hash = {}) { block }
282
+ # -->
283
+ # Create a new CGI instance.
284
+ #
285
+ # `tag_maker`
286
+ # : This is the same as using the `options_hash` form with the value `{
287
+ # :tag_maker => tag_maker }` Note that it is recommended to use the
288
+ # `options_hash` form, since it also allows you specify the charset you will
289
+ # accept.
290
+ #
291
+ # `options_hash`
292
+ # : A Hash that recognizes three options:
293
+ #
294
+ # `:accept_charset`
295
+ # : specifies encoding of received query string. If omitted,
296
+ # `@@accept_charset` is used. If the encoding is not valid, a
297
+ # CGI::InvalidEncoding will be raised.
298
+ #
299
+ # Example. Suppose `@@accept_charset` is "UTF-8"
300
+ #
301
+ # when not specified:
302
+ #
303
+ # cgi=CGI.new # @accept_charset # => "UTF-8"
304
+ #
305
+ # when specified as "EUC-JP":
306
+ #
307
+ # cgi=CGI.new(:accept_charset => "EUC-JP") # => "EUC-JP"
308
+ #
309
+ #
310
+ # `:tag_maker`
311
+ # : String that specifies which version of the HTML generation methods to
312
+ # use. If not specified, no HTML generation methods will be loaded.
313
+ #
314
+ # The following values are supported:
315
+ #
316
+ # "html3"
317
+ # : HTML 3.x
318
+ #
319
+ # "html4"
320
+ # : HTML 4.0
321
+ #
322
+ # "html4Tr"
323
+ # : HTML 4.0 Transitional
324
+ #
325
+ # "html4Fr"
326
+ # : HTML 4.0 with Framesets
327
+ #
328
+ # "html5"
329
+ # : HTML 5
330
+ #
331
+ #
332
+ #
333
+ # `:max_multipart_length`
334
+ # : Specifies maximum length of multipart data. Can be an Integer scalar
335
+ # or a lambda, that will be evaluated when the request is parsed. This
336
+ # allows more complex logic to be set when determining whether to accept
337
+ # multipart data (e.g. consult a registered users upload allowance)
338
+ #
339
+ # Default is 128 * 1024 * 1024 bytes
340
+ #
341
+ # cgi=CGI.new(:max_multipart_length => 268435456) # simple scalar
342
+ #
343
+ # cgi=CGI.new(:max_multipart_length => -> {check_filesystem}) # lambda
344
+ #
345
+ #
346
+ #
347
+ # `block`
348
+ # : If provided, the block is called when an invalid encoding is encountered.
349
+ # For example:
350
+ #
351
+ # encoding_errors={}
352
+ # cgi=CGI.new(:accept_charset=>"EUC-JP") do |name,value|
353
+ # encoding_errors[name] = value
354
+ # end
355
+ #
356
+ #
357
+ # Finally, if the CGI object is not created in a standard CGI call environment
358
+ # (that is, it can't locate REQUEST_METHOD in its environment), then it will run
359
+ # in "offline" mode. In this mode, it reads its parameters from the command
360
+ # line or (failing that) from standard input. Otherwise, cookies and other
361
+ # parameters are parsed automatically from the standard CGI locations, which
362
+ # varies according to the REQUEST_METHOD.
363
+ #
364
+ def initialize: (?String tag_maker) ?{ (String name, String value) -> void } -> void
365
+ | (Hash[Symbol, untyped] options_hash) ?{ (String name, String value) -> void } -> void
366
+
367
+ # <!--
368
+ # rdoc-file=lib/cgi/core.rb
369
+ # - accept_charset()
370
+ # -->
371
+ # Return the accept character set for all new CGI instances.
372
+ #
373
+ def self.accept_charset: () -> encoding
374
+
375
+ # <!--
376
+ # rdoc-file=lib/cgi/core.rb
377
+ # - accept_charset=(accept_charset)
378
+ # -->
379
+ # Set the accept character set for all new CGI instances.
380
+ #
381
+ def self.accept_charset=: (encoding accept_charset) -> encoding
382
+
383
+ # <!--
384
+ # rdoc-file=lib/cgi/core.rb
385
+ # - parse(query)
386
+ # -->
387
+ # Parse an HTTP query string into a hash of key=>value pairs.
388
+ #
389
+ # params = CGI.parse("query_string")
390
+ # # {"name1" => ["value1", "value2", ...],
391
+ # # "name2" => ["value1", "value2", ...], ... }
392
+ #
393
+ def self.parse: (String query) -> Hash[String, Array[String]]
394
+
395
+ # <!-- rdoc-file=lib/cgi/core.rb -->
396
+ # Return the accept character set for this CGI instance.
397
+ #
398
+ attr_reader accept_charset: encoding
399
+
400
+ # <!-- rdoc-file=lib/cgi/core.rb -->
401
+ # This method is an alias for #http_header, when HTML5 tag maker is inactive.
402
+ #
403
+ # NOTE: use #http_header to create HTTP header blocks, this alias is only
404
+ # provided for backwards compatibility.
405
+ #
406
+ # Using #header with the HTML5 tag maker will create a <header> element.
407
+ #
408
+ alias header http_header
409
+
410
+ # <!--
411
+ # rdoc-file=lib/cgi/core.rb
412
+ # - http_header(content_type_string="text/html")
413
+ # - http_header(headers_hash)
414
+ # -->
415
+ # Create an HTTP header block as a string.
416
+ #
417
+ # Includes the empty line that ends the header block.
418
+ #
419
+ # `content_type_string`
420
+ # : If this form is used, this string is the `Content-Type`
421
+ #
422
+ # `headers_hash`
423
+ # : A Hash of header values. The following header keys are recognized:
424
+ #
425
+ # type
426
+ # : The Content-Type header. Defaults to "text/html"
427
+ #
428
+ # charset
429
+ # : The charset of the body, appended to the Content-Type header.
430
+ #
431
+ # nph
432
+ # : A boolean value. If true, prepend protocol string and status code,
433
+ # and date; and sets default values for "server" and "connection" if not
434
+ # explicitly set.
435
+ #
436
+ # status
437
+ # : The HTTP status code as a String, returned as the Status header. The
438
+ # values are:
439
+ #
440
+ # OK
441
+ # : 200 OK
442
+ #
443
+ # PARTIAL_CONTENT
444
+ # : 206 Partial Content
445
+ #
446
+ # MULTIPLE_CHOICES
447
+ # : 300 Multiple Choices
448
+ #
449
+ # MOVED
450
+ # : 301 Moved Permanently
451
+ #
452
+ # REDIRECT
453
+ # : 302 Found
454
+ #
455
+ # NOT_MODIFIED
456
+ # : 304 Not Modified
457
+ #
458
+ # BAD_REQUEST
459
+ # : 400 Bad Request
460
+ #
461
+ # AUTH_REQUIRED
462
+ # : 401 Authorization Required
463
+ #
464
+ # FORBIDDEN
465
+ # : 403 Forbidden
466
+ #
467
+ # NOT_FOUND
468
+ # : 404 Not Found
469
+ #
470
+ # METHOD_NOT_ALLOWED
471
+ # : 405 Method Not Allowed
472
+ #
473
+ # NOT_ACCEPTABLE
474
+ # : 406 Not Acceptable
475
+ #
476
+ # LENGTH_REQUIRED
477
+ # : 411 Length Required
478
+ #
479
+ # PRECONDITION_FAILED
480
+ # : 412 Precondition Failed
481
+ #
482
+ # SERVER_ERROR
483
+ # : 500 Internal Server Error
484
+ #
485
+ # NOT_IMPLEMENTED
486
+ # : 501 Method Not Implemented
487
+ #
488
+ # BAD_GATEWAY
489
+ # : 502 Bad Gateway
490
+ #
491
+ # VARIANT_ALSO_VARIES
492
+ # : 506 Variant Also Negotiates
493
+ #
494
+ #
495
+ #
496
+ # server
497
+ # : The server software, returned as the Server header.
498
+ #
499
+ # connection
500
+ # : The connection type, returned as the Connection header (for instance,
501
+ # "close".
502
+ #
503
+ # length
504
+ # : The length of the content that will be sent, returned as the
505
+ # Content-Length header.
506
+ #
507
+ # language
508
+ # : The language of the content, returned as the Content-Language header.
509
+ #
510
+ # expires
511
+ # : The time on which the current content expires, as a `Time` object,
512
+ # returned as the Expires header.
513
+ #
514
+ # cookie
515
+ # : A cookie or cookies, returned as one or more Set-Cookie headers. The
516
+ # value can be the literal string of the cookie; a CGI::Cookie object;
517
+ # an Array of literal cookie strings or Cookie objects; or a hash all of
518
+ # whose values are literal cookie strings or Cookie objects.
519
+ #
520
+ # These cookies are in addition to the cookies held in the
521
+ # @output_cookies field.
522
+ #
523
+ #
524
+ # Other headers can also be set; they are appended as key: value.
525
+ #
526
+ #
527
+ # Examples:
528
+ #
529
+ # http_header
530
+ # # Content-Type: text/html
531
+ #
532
+ # http_header("text/plain")
533
+ # # Content-Type: text/plain
534
+ #
535
+ # http_header("nph" => true,
536
+ # "status" => "OK", # == "200 OK"
537
+ # # "status" => "200 GOOD",
538
+ # "server" => ENV['SERVER_SOFTWARE'],
539
+ # "connection" => "close",
540
+ # "type" => "text/html",
541
+ # "charset" => "iso-2022-jp",
542
+ # # Content-Type: text/html; charset=iso-2022-jp
543
+ # "length" => 103,
544
+ # "language" => "ja",
545
+ # "expires" => Time.now + 30,
546
+ # "cookie" => [cookie1, cookie2],
547
+ # "my_header1" => "my_value",
548
+ # "my_header2" => "my_value")
549
+ #
550
+ # This method does not perform charset conversion.
551
+ #
552
+ def http_header: (?String options) -> String
553
+ | (?Hash[interned, untyped] header_hash) -> String
554
+
555
+ def nph?: () -> untyped
556
+
557
+ # <!--
558
+ # rdoc-file=lib/cgi/core.rb
559
+ # - cgi.out(content_type_string='text/html')
560
+ # - cgi.out(headers_hash)
561
+ # -->
562
+ # Print an HTTP header and body to $DEFAULT_OUTPUT ($>)
563
+ #
564
+ # `content_type_string`
565
+ # : If a string is passed, it is assumed to be the content type.
566
+ #
567
+ # `headers_hash`
568
+ # : This is a Hash of headers, similar to that used by #http_header.
569
+ #
570
+ # `block`
571
+ # : A block is required and should evaluate to the body of the response.
572
+ #
573
+ #
574
+ # `Content-Length` is automatically calculated from the size of the String
575
+ # returned by the content block.
576
+ #
577
+ # If `ENV['REQUEST_METHOD'] == "HEAD"`, then only the header is output (the
578
+ # content block is still required, but it is ignored).
579
+ #
580
+ # If the charset is "iso-2022-jp" or "euc-jp" or "shift_jis" then the content is
581
+ # converted to this charset, and the language is set to "ja".
582
+ #
583
+ # Example:
584
+ #
585
+ # cgi = CGI.new
586
+ # cgi.out{ "string" }
587
+ # # Content-Type: text/html
588
+ # # Content-Length: 6
589
+ # #
590
+ # # string
591
+ #
592
+ # cgi.out("text/plain") { "string" }
593
+ # # Content-Type: text/plain
594
+ # # Content-Length: 6
595
+ # #
596
+ # # string
597
+ #
598
+ # cgi.out("nph" => true,
599
+ # "status" => "OK", # == "200 OK"
600
+ # "server" => ENV['SERVER_SOFTWARE'],
601
+ # "connection" => "close",
602
+ # "type" => "text/html",
603
+ # "charset" => "iso-2022-jp",
604
+ # # Content-Type: text/html; charset=iso-2022-jp
605
+ # "language" => "ja",
606
+ # "expires" => Time.now + (3600 * 24 * 30),
607
+ # "cookie" => [cookie1, cookie2],
608
+ # "my_header1" => "my_value",
609
+ # "my_header2" => "my_value") { "string" }
610
+ # # HTTP/1.1 200 OK
611
+ # # Date: Sun, 15 May 2011 17:35:54 GMT
612
+ # # Server: Apache 2.2.0
613
+ # # Connection: close
614
+ # # Content-Type: text/html; charset=iso-2022-jp
615
+ # # Content-Length: 6
616
+ # # Content-Language: ja
617
+ # # Expires: Tue, 14 Jun 2011 17:35:54 GMT
618
+ # # Set-Cookie: foo
619
+ # # Set-Cookie: bar
620
+ # # my_header1: my_value
621
+ # # my_header2: my_value
622
+ # #
623
+ # # string
624
+ #
625
+ def out: (?String content_type_string) { () -> String } -> void
626
+ | (Hash[interned, untyped] headers_hash) { () -> String } -> void
627
+
628
+ # <!--
629
+ # rdoc-file=lib/cgi/core.rb
630
+ # - print(*options)
631
+ # -->
632
+ # Print an argument or list of arguments to the default output stream
633
+ #
634
+ # cgi = CGI.new
635
+ # cgi.print # default: cgi.print == $DEFAULT_OUTPUT.print
636
+ #
637
+ def print: (*String options) -> void
638
+
639
+ private
640
+
641
+ # <!--
642
+ # rdoc-file=lib/cgi/core.rb
643
+ # - stdinput()
644
+ # -->
645
+ # Synonym for $stdin.
646
+ #
647
+ def stdinput: () -> ::IO
648
+
649
+ # <!--
650
+ # rdoc-file=lib/cgi/core.rb
651
+ # - stdoutput()
652
+ # -->
653
+ # Synonym for $stdout.
654
+ #
655
+ def stdoutput: () -> ::IO
656
+
657
+ # <!-- rdoc-file=lib/cgi/core.rb -->
658
+ # String for carriage return
659
+ #
660
+ CR: String
661
+
662
+ # <!-- rdoc-file=lib/cgi/core.rb -->
663
+ # Standard internet newline sequence
664
+ #
665
+ EOL: String
666
+
667
+ # <!-- rdoc-file=lib/cgi/core.rb -->
668
+ # HTTP status codes.
669
+ #
670
+ HTTP_STATUS: Hash[String, String]
671
+
672
+ # <!-- rdoc-file=lib/cgi/core.rb -->
673
+ # String for linefeed
674
+ #
675
+ LF: String
676
+
677
+ # <!-- rdoc-file=lib/cgi/core.rb -->
678
+ # Maximum number of request parameters when multipart
679
+ #
680
+ MAX_MULTIPART_COUNT: Integer
681
+
682
+ # <!-- rdoc-file=lib/cgi/core.rb -->
683
+ # Whether processing will be required in binary vs text
684
+ #
685
+ NEEDS_BINMODE: bool
686
+
687
+ # <!-- rdoc-file=lib/cgi/core.rb -->
688
+ # Path separators in different environments.
689
+ #
690
+ PATH_SEPARATOR: Hash[String, String]
691
+
692
+ REVISION: String
693
+
694
+ VERSION: String
695
+
696
+ # <!-- rdoc-file=lib/cgi/cookie.rb -->
697
+ # Class representing an HTTP cookie.
698
+ #
699
+ # In addition to its specific fields and methods, a Cookie instance is a
700
+ # delegator to the array of its values.
701
+ #
702
+ # See RFC 2965.
703
+ #
704
+ # ## Examples of use
705
+ # cookie1 = CGI::Cookie.new("name", "value1", "value2", ...)
706
+ # cookie1 = CGI::Cookie.new("name" => "name", "value" => "value")
707
+ # cookie1 = CGI::Cookie.new('name' => 'name',
708
+ # 'value' => ['value1', 'value2', ...],
709
+ # 'path' => 'path', # optional
710
+ # 'domain' => 'domain', # optional
711
+ # 'expires' => Time.now, # optional
712
+ # 'secure' => true, # optional
713
+ # 'httponly' => true # optional
714
+ # )
715
+ #
716
+ # cgi.out("cookie" => [cookie1, cookie2]) { "string" }
717
+ #
718
+ # name = cookie1.name
719
+ # values = cookie1.value
720
+ # path = cookie1.path
721
+ # domain = cookie1.domain
722
+ # expires = cookie1.expires
723
+ # secure = cookie1.secure
724
+ # httponly = cookie1.httponly
725
+ #
726
+ # cookie1.name = 'name'
727
+ # cookie1.value = ['value1', 'value2', ...]
728
+ # cookie1.path = 'path'
729
+ # cookie1.domain = 'domain'
730
+ # cookie1.expires = Time.now + 30
731
+ # cookie1.secure = true
732
+ # cookie1.httponly = true
733
+ #
734
+ class Cookie < Array[String]
735
+ # <!--
736
+ # rdoc-file=lib/cgi/cookie.rb
737
+ # - parse(raw_cookie)
738
+ # -->
739
+ # Parse a raw cookie string into a hash of cookie-name=>Cookie pairs.
740
+ #
741
+ # cookies = CGI::Cookie.parse("raw_cookie_string")
742
+ # # { "name1" => cookie1, "name2" => cookie2, ... }
743
+ #
744
+ def self.parse: (String raw_cookie) -> Hash[String, instance]
745
+
746
+ # <!-- rdoc-file=lib/cgi/cookie.rb -->
747
+ # Domain for which this cookie applies, as a `String`
748
+ #
749
+ def domain: () -> String?
750
+
751
+ # <!--
752
+ # rdoc-file=lib/cgi/cookie.rb
753
+ # - domain=(str)
754
+ # -->
755
+ # Set domain for which this cookie applies
756
+ #
757
+ def domain=: (String domain) -> String
758
+
759
+ # <!-- rdoc-file=lib/cgi/cookie.rb -->
760
+ # Time at which this cookie expires, as a `Time`
761
+ #
762
+ def expires: () -> Time?
763
+
764
+ # <!-- rdoc-file=lib/cgi/cookie.rb -->
765
+ # Time at which this cookie expires, as a `Time`
766
+ #
767
+ def expires=: (Time time) -> Time
768
+
769
+ # <!-- rdoc-file=lib/cgi/cookie.rb -->
770
+ # True if this cookie is httponly; false otherwise
771
+ #
772
+ def httponly: () -> bool
773
+
774
+ # <!--
775
+ # rdoc-file=lib/cgi/cookie.rb
776
+ # - httponly=(val)
777
+ # -->
778
+ # Set whether the Cookie is a httponly cookie or not.
779
+ #
780
+ # `val` must be a boolean.
781
+ #
782
+ def httponly=: (boolish val) -> bool
783
+
784
+ # <!--
785
+ # rdoc-file=lib/cgi/cookie.rb
786
+ # - inspect()
787
+ # -->
788
+ # A summary of cookie string.
789
+ #
790
+ def inspect: () -> String
791
+
792
+ # <!-- rdoc-file=lib/cgi/cookie.rb -->
793
+ # Name of this cookie, as a `String`
794
+ #
795
+ def name: () -> String
796
+
797
+ # <!--
798
+ # rdoc-file=lib/cgi/cookie.rb
799
+ # - name=(str)
800
+ # -->
801
+ # Set name of this cookie
802
+ #
803
+ def name=: (String name) -> String
804
+
805
+ # <!-- rdoc-file=lib/cgi/cookie.rb -->
806
+ # Path for which this cookie applies, as a `String`
807
+ #
808
+ def path: () -> String?
809
+
810
+ # <!--
811
+ # rdoc-file=lib/cgi/cookie.rb
812
+ # - path=(str)
813
+ # -->
814
+ # Set path for which this cookie applies
815
+ #
816
+ def path=: (String path) -> String
817
+
818
+ # <!-- rdoc-file=lib/cgi/cookie.rb -->
819
+ # True if this cookie is secure; false otherwise
820
+ #
821
+ def secure: () -> bool
822
+
823
+ # <!--
824
+ # rdoc-file=lib/cgi/cookie.rb
825
+ # - secure=(val)
826
+ # -->
827
+ # Set whether the Cookie is a secure cookie or not.
828
+ #
829
+ # `val` must be a boolean.
830
+ #
831
+ def secure=: [A] (boolish val) -> A
832
+
833
+ # <!--
834
+ # rdoc-file=lib/cgi/cookie.rb
835
+ # - to_s()
836
+ # -->
837
+ # Convert the Cookie to its string representation.
838
+ #
839
+ def to_s: () -> String
840
+
841
+ # <!--
842
+ # rdoc-file=lib/cgi/cookie.rb
843
+ # - value()
844
+ # -->
845
+ # Returns the value or list of values for this cookie.
846
+ #
847
+ def value: () -> Array[String]
848
+
849
+ # <!--
850
+ # rdoc-file=lib/cgi/cookie.rb
851
+ # - value=(val)
852
+ # -->
853
+ # Replaces the value of this cookie with a new value or list of values.
854
+ #
855
+ def value=: (String val) -> String
856
+ | (Array[String] val) -> Array[String]
857
+
858
+ private
859
+
860
+ # <!--
861
+ # rdoc-file=lib/cgi/cookie.rb
862
+ # - Cookie.new(name_string,*value)
863
+ # - Cookie.new(options_hash)
864
+ # -->
865
+ # Create a new CGI::Cookie object.
866
+ #
867
+ # `name_string`
868
+ # : The name of the cookie; in this form, there is no #domain or #expiration.
869
+ # The #path is gleaned from the `SCRIPT_NAME` environment variable, and
870
+ # #secure is false.
871
+ #
872
+ # `*value`
873
+ # : value or list of values of the cookie
874
+ #
875
+ # `options_hash`
876
+ # : A Hash of options to initialize this Cookie. Possible options are:
877
+ #
878
+ # name
879
+ # : the name of the cookie. Required.
880
+ #
881
+ # value
882
+ # : the cookie's value or list of values.
883
+ #
884
+ # path
885
+ # : the path for which this cookie applies. Defaults to the value of the
886
+ # `SCRIPT_NAME` environment variable.
887
+ #
888
+ # domain
889
+ # : the domain for which this cookie applies.
890
+ #
891
+ # expires
892
+ # : the time at which this cookie expires, as a `Time` object.
893
+ #
894
+ # secure
895
+ # : whether this cookie is a secure cookie or not (default to false).
896
+ # Secure cookies are only transmitted to HTTPS servers.
897
+ #
898
+ # httponly
899
+ # : whether this cookie is a HttpOnly cookie or not (default to
900
+ #
901
+ # false). HttpOnly cookies are not available to javascript.
902
+ #
903
+ # These keywords correspond to attributes of the cookie object.
904
+ #
905
+ def initialize: (String name_string, *String value) -> void
906
+ | (Hash[String, untyped] options_hash) -> void
907
+ end
908
+
909
+ module Escape
910
+ # <!--
911
+ # rdoc-file=ext/cgi/escape/escape.c
912
+ # - CGI.escape(string) -> string
913
+ # -->
914
+ # Returns URL-escaped string (`application/x-www-form-urlencoded`).
915
+ #
916
+ def escape: (string str) -> String
917
+
918
+ # <!--
919
+ # rdoc-file=ext/cgi/escape/escape.c
920
+ # - CGI.escapeHTML(string) -> string
921
+ # -->
922
+ # Returns HTML-escaped string.
923
+ #
924
+ def escapeHTML: (string str) -> String
925
+
926
+ # <!--
927
+ # rdoc-file=ext/cgi/escape/escape.c
928
+ # - CGI.escapeURIComponent(string) -> string
929
+ # -->
930
+ # Returns URL-escaped string following RFC 3986.
931
+ #
932
+ def escapeURIComponent: (string) -> String
933
+
934
+ # <!--
935
+ # rdoc-file=ext/cgi/escape/escape.c
936
+ # - CGI.unescape(string, encoding=@@accept_charset) -> string
937
+ # -->
938
+ # Returns URL-unescaped string (`application/x-www-form-urlencoded`).
939
+ #
940
+ def unescape: (string str, ?encoding encoding) -> String
941
+
942
+ # <!--
943
+ # rdoc-file=ext/cgi/escape/escape.c
944
+ # - CGI.unescapeHTML(string) -> string
945
+ # -->
946
+ # Returns HTML-unescaped string.
947
+ #
948
+ def unescapeHTML: (string str) -> String
949
+
950
+ # <!--
951
+ # rdoc-file=ext/cgi/escape/escape.c
952
+ # - CGI.unescapeURIComponent(string, encoding=@@accept_charset) -> string
953
+ # -->
954
+ # Returns URL-unescaped string following RFC 3986.
955
+ #
956
+ def unescapeURIComponent: (string) -> String
957
+ end
958
+
959
+ # <!-- rdoc-file=lib/cgi/core.rb -->
960
+ # Exception raised when there is an invalid encoding detected
961
+ #
962
+ class InvalidEncoding < Exception
963
+ end
964
+
965
+ # <!-- rdoc-file=lib/cgi/core.rb -->
966
+ # Mixin module that provides the following:
967
+ #
968
+ # 1. Access to the CGI environment variables as methods. See documentation to
969
+ # the CGI class for a list of these variables. The methods are exposed by
970
+ # removing the leading `HTTP_` (if it exists) and downcasing the name. For
971
+ # example, `auth_type` will return the environment variable `AUTH_TYPE`, and
972
+ # `accept` will return the value for `HTTP_ACCEPT`.
973
+ #
974
+ # 2. Access to cookies, including the cookies attribute.
975
+ #
976
+ # 3. Access to parameters, including the params attribute, and overloading #[]
977
+ # to perform parameter value lookup by key.
978
+ #
979
+ # 4. The initialize_query method, for initializing the above mechanisms,
980
+ # handling multipart forms, and allowing the class to be used in "offline"
981
+ # mode.
982
+ #
983
+ module QueryExtension
984
+ # <!--
985
+ # rdoc-file=lib/cgi/core.rb
986
+ # - [](key)
987
+ # -->
988
+ # Get the value for the parameter with a given key.
989
+ #
990
+ # If the parameter has multiple values, only the first will be retrieved; use
991
+ # #params to get the array of values.
992
+ #
993
+ def []: (String key) -> String?
994
+
995
+ def accept: () -> String?
996
+
997
+ def accept_charset: () -> String?
998
+
999
+ def accept_encoding: () -> String?
1000
+
1001
+ def accept_language: () -> String?
1002
+
1003
+ def auth_type: () -> String?
1004
+
1005
+ def cache_control: () -> String?
1006
+
1007
+ def content_length: () -> String?
1008
+
1009
+ def content_type: () -> String?
1010
+
1011
+ # <!-- rdoc-file=lib/cgi/core.rb -->
1012
+ # Get the cookies as a hash of cookie-name=>Cookie pairs.
1013
+ #
1014
+ def cookies: () -> Hash[String, Cookie]
1015
+
1016
+ # <!-- rdoc-file=lib/cgi/core.rb -->
1017
+ # Get the cookies as a hash of cookie-name=>Cookie pairs.
1018
+ #
1019
+ def cookies=: (Hash[String, Cookie] cookies) -> Hash[String, Cookie]
1020
+
1021
+ def create_body: (boolish is_large) -> (Tempfile | StringIO)
1022
+
1023
+ # <!-- rdoc-file=lib/cgi/core.rb -->
1024
+ # Get the uploaded files as a hash of name=>values pairs
1025
+ #
1026
+ def files: () -> Hash[String, Tempfile | StringIO]
1027
+
1028
+ def from: () -> String?
1029
+
1030
+ def gateway_interface: () -> String?
1031
+
1032
+ # <!--
1033
+ # rdoc-file=lib/cgi/core.rb
1034
+ # - has_key?(*args)
1035
+ # -->
1036
+ # Returns true if a given query string parameter exists.
1037
+ #
1038
+ def has_key?: (String key) -> bool
1039
+
1040
+ def host: () -> String?
1041
+
1042
+ # <!--
1043
+ # rdoc-file=lib/cgi/core.rb
1044
+ # - include?(*args)
1045
+ # -->
1046
+ #
1047
+ alias include? has_key?
1048
+
1049
+ # <!--
1050
+ # rdoc-file=lib/cgi/core.rb
1051
+ # - key?(*args)
1052
+ # -->
1053
+ #
1054
+ alias key? has_key?
1055
+
1056
+ # <!--
1057
+ # rdoc-file=lib/cgi/core.rb
1058
+ # - keys(*args)
1059
+ # -->
1060
+ # Return all query parameter names as an array of String.
1061
+ #
1062
+ def keys: () -> Array[String]
1063
+
1064
+ # <!--
1065
+ # rdoc-file=lib/cgi/core.rb
1066
+ # - multipart?()
1067
+ # -->
1068
+ # Returns whether the form contained multipart/form-data
1069
+ #
1070
+ def multipart?: () -> bool
1071
+
1072
+ def negotiate: () -> String?
1073
+
1074
+ # <!-- rdoc-file=lib/cgi/core.rb -->
1075
+ # Get the parameters as a hash of name=>values pairs, where values is an Array.
1076
+ #
1077
+ def params: () -> Hash[String, Array[String] | Tempfile | StringIO]
1078
+
1079
+ # <!--
1080
+ # rdoc-file=lib/cgi/core.rb
1081
+ # - params=(hash)
1082
+ # -->
1083
+ # Set all the parameters.
1084
+ #
1085
+ def params=: (Hash[String, Array[String] | Tempfile | StringIO] hash) -> Hash[String, Array[String] | Tempfile | StringIO]
1086
+
1087
+ def path_info: () -> String?
1088
+
1089
+ def path_translated: () -> String?
1090
+
1091
+ def pragma: () -> String?
1092
+
1093
+ def query_string: () -> String?
1094
+
1095
+ # <!--
1096
+ # rdoc-file=lib/cgi/core.rb
1097
+ # - raw_cookie()
1098
+ # -->
1099
+ # Get the raw cookies as a string.
1100
+ #
1101
+ def raw_cookie: () -> String?
1102
+
1103
+ # <!--
1104
+ # rdoc-file=lib/cgi/core.rb
1105
+ # - raw_cookie2()
1106
+ # -->
1107
+ # Get the raw RFC2965 cookies as a string.
1108
+ #
1109
+ def raw_cookie2: () -> String?
1110
+
1111
+ def referer: () -> String?
1112
+
1113
+ def remote_addr: () -> String?
1114
+
1115
+ def remote_host: () -> String?
1116
+
1117
+ def remote_ident: () -> String?
1118
+
1119
+ def remote_user: () -> String?
1120
+
1121
+ def request_method: () -> String?
1122
+
1123
+ def script_name: () -> String?
1124
+
1125
+ def server_name: () -> String?
1126
+
1127
+ def server_port: () -> String?
1128
+
1129
+ def server_protocol: () -> String?
1130
+
1131
+ def server_software: () -> String?
1132
+
1133
+ def unescape_filename?: () -> bool
1134
+
1135
+ def user_agent: () -> String?
1136
+
1137
+ private
1138
+
1139
+ # <!--
1140
+ # rdoc-file=lib/cgi/core.rb
1141
+ # - initialize_query()
1142
+ # -->
1143
+ # A wrapper class to use a StringIO object as the body and switch to a TempFile
1144
+ # when the passed threshold is passed. Initialize the data from the query.
1145
+ #
1146
+ # Handles multipart forms (in particular, forms that involve file uploads).
1147
+ # Reads query parameters in the @params field, and cookies into @cookies.
1148
+ #
1149
+ def initialize_query: () -> void
1150
+
1151
+ # <!--
1152
+ # rdoc-file=lib/cgi/core.rb
1153
+ # - read_from_cmdline()
1154
+ # -->
1155
+ # offline mode. read name=value pairs on standard input.
1156
+ #
1157
+ def read_from_cmdline: () -> String
1158
+
1159
+ # <!--
1160
+ # rdoc-file=lib/cgi/core.rb
1161
+ # - read_multipart(boundary, content_length)
1162
+ # -->
1163
+ # Parses multipart form elements according to
1164
+ # http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2
1165
+ #
1166
+ # Returns a hash of multipart form parameters with bodies of type StringIO or
1167
+ # Tempfile depending on whether the multipart form element exceeds 10 KB
1168
+ #
1169
+ # params[name => body]
1170
+ #
1171
+ def read_multipart: (String boundary, Integer content_length) -> (Tempfile | StringIO)
1172
+ end
1173
+
1174
+ module Util
1175
+ include CGI::Escape
1176
+
1177
+ # <!--
1178
+ # rdoc-file=lib/cgi/util.rb
1179
+ # - escapeElement(string, *elements)
1180
+ # -->
1181
+ # Escape only the tags of certain HTML elements in `string`.
1182
+ #
1183
+ # Takes an element or elements or array of elements. Each element is specified
1184
+ # by the name of the element, without angle brackets. This matches both the
1185
+ # start and the end tag of that element. The attribute list of the open tag will
1186
+ # also be escaped (for instance, the double-quotes surrounding attribute
1187
+ # values).
1188
+ #
1189
+ # print CGI.escapeElement('<BR><A HREF="url"></A>', "A", "IMG")
1190
+ # # "<BR>&lt;A HREF=&quot;url&quot;&gt;&lt;/A&gt"
1191
+ #
1192
+ # print CGI.escapeElement('<BR><A HREF="url"></A>', ["A", "IMG"])
1193
+ # # "<BR>&lt;A HREF=&quot;url&quot;&gt;&lt;/A&gt"
1194
+ #
1195
+ def escapeElement: (string string, *String | Array[String] elements) -> String
1196
+
1197
+ # <!-- rdoc-file=lib/cgi/util.rb -->
1198
+ # Synonym for CGI.escapeElement(str)
1199
+ #
1200
+ alias escape_element escapeElement
1201
+
1202
+ # <!-- rdoc-file=lib/cgi/util.rb -->
1203
+ # Synonym for CGI.escapeHTML(str)
1204
+ #
1205
+ alias escape_html escapeHTML
1206
+
1207
+ # <!--
1208
+ # rdoc-file=lib/cgi/util.rb
1209
+ # - h(string)
1210
+ # -->
1211
+ #
1212
+ alias h escapeHTML
1213
+
1214
+ # <!--
1215
+ # rdoc-file=lib/cgi/util.rb
1216
+ # - pretty(string, shift = " ")
1217
+ # -->
1218
+ # Prettify (indent) an HTML string.
1219
+ #
1220
+ # `string` is the HTML string to indent. `shift` is the indentation unit to
1221
+ # use; it defaults to two spaces.
1222
+ #
1223
+ # print CGI.pretty("<HTML><BODY></BODY></HTML>")
1224
+ # # <HTML>
1225
+ # # <BODY>
1226
+ # # </BODY>
1227
+ # # </HTML>
1228
+ #
1229
+ # print CGI.pretty("<HTML><BODY></BODY></HTML>", "\t")
1230
+ # # <HTML>
1231
+ # # <BODY>
1232
+ # # </BODY>
1233
+ # # </HTML>
1234
+ #
1235
+ def pretty: (string string, ?String shift) -> String
1236
+
1237
+ # <!--
1238
+ # rdoc-file=lib/cgi/util.rb
1239
+ # - rfc1123_date(time)
1240
+ # -->
1241
+ # Format a `Time` object as a String using the format specified by RFC 1123.
1242
+ #
1243
+ # CGI.rfc1123_date(Time.now)
1244
+ # # Sat, 01 Jan 2000 00:00:00 GMT
1245
+ #
1246
+ def rfc1123_date: (Time time) -> String
1247
+
1248
+ # <!--
1249
+ # rdoc-file=lib/cgi/util.rb
1250
+ # - unescapeElement(string, *elements)
1251
+ # -->
1252
+ # Undo escaping such as that done by CGI.escapeElement()
1253
+ #
1254
+ # print CGI.unescapeElement(
1255
+ # CGI.escapeHTML('<BR><A HREF="url"></A>'), "A", "IMG")
1256
+ # # "&lt;BR&gt;<A HREF="url"></A>"
1257
+ #
1258
+ # print CGI.unescapeElement(
1259
+ # CGI.escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"])
1260
+ # # "&lt;BR&gt;<A HREF="url"></A>"
1261
+ #
1262
+ def unescapeElement: (string string, *String | Array[String] elements) -> String
1263
+
1264
+ # <!-- rdoc-file=lib/cgi/util.rb -->
1265
+ # Synonym for CGI.unescapeElement(str)
1266
+ #
1267
+ alias unescape_element unescapeElement
1268
+
1269
+ # <!-- rdoc-file=lib/cgi/util.rb -->
1270
+ # Synonym for CGI.unescapeHTML(str)
1271
+ #
1272
+ alias unescape_html unescapeHTML
1273
+
1274
+ # Abbreviated day-of-week names specified by RFC 822
1275
+ RFC822_DAYS: Array[String]
1276
+
1277
+ # Abbreviated month names specified by RFC 822
1278
+ RFC822_MONTHS: Array[String]
1279
+
1280
+ # <!-- rdoc-file=lib/cgi/util.rb -->
1281
+ # The set of special characters and their escaped values
1282
+ #
1283
+ TABLE_FOR_ESCAPE_HTML__: Hash[String, String]
1284
+ end
1285
+ end