@blazetrails/ruby-compat 0.0.0-stage → 0.1.0-alpha0.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 (622) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +6 -0
  3. package/README.md +440 -2
  4. package/dist/argument-error.d.ts +15 -0
  5. package/dist/argument-error.js +15 -0
  6. package/dist/argument-error.js.map +1 -0
  7. package/dist/array.d.ts +415 -0
  8. package/dist/array.js +1330 -0
  9. package/dist/array.js.map +1 -0
  10. package/dist/async-context-adapter.d.ts +19 -0
  11. package/dist/async-context-adapter.js +139 -0
  12. package/dist/async-context-adapter.js.map +1 -0
  13. package/dist/backtrace-location.d.ts +77 -0
  14. package/dist/backtrace-location.js +155 -0
  15. package/dist/backtrace-location.js.map +1 -0
  16. package/dist/base64.d.ts +73 -0
  17. package/dist/base64.js +164 -0
  18. package/dist/base64.js.map +1 -0
  19. package/dist/benchmark.d.ts +19 -0
  20. package/dist/benchmark.js +16 -0
  21. package/dist/benchmark.js.map +1 -0
  22. package/dist/big-decimal.d.ts +110 -0
  23. package/dist/big-decimal.js +582 -0
  24. package/dist/big-decimal.js.map +1 -0
  25. package/dist/bundler.d.ts +44 -0
  26. package/dist/bundler.js +101 -0
  27. package/dist/bundler.js.map +1 -0
  28. package/dist/cgi.d.ts +89 -0
  29. package/dist/cgi.js +168 -0
  30. package/dist/cgi.js.map +1 -0
  31. package/dist/child-process-adapter.d.ts +110 -0
  32. package/dist/child-process-adapter.js +272 -0
  33. package/dist/child-process-adapter.js.map +1 -0
  34. package/dist/class-module.d.ts +10 -0
  35. package/dist/class-module.js +10 -0
  36. package/dist/class-module.js.map +1 -0
  37. package/dist/classpath.d.ts +90 -0
  38. package/dist/classpath.js +207 -0
  39. package/dist/classpath.js.map +1 -0
  40. package/dist/closed-queue-error.d.ts +10 -0
  41. package/dist/closed-queue-error.js +10 -0
  42. package/dist/closed-queue-error.js.map +1 -0
  43. package/dist/comparable.d.ts +127 -0
  44. package/dist/comparable.js +376 -0
  45. package/dist/comparable.js.map +1 -0
  46. package/dist/complex.d.ts +48 -0
  47. package/dist/complex.js +162 -0
  48. package/dist/complex.js.map +1 -0
  49. package/dist/concurrent/atomic-boolean.d.ts +24 -0
  50. package/dist/concurrent/atomic-boolean.js +43 -0
  51. package/dist/concurrent/atomic-boolean.js.map +1 -0
  52. package/dist/concurrent/atomic-fixnum.d.ts +21 -0
  53. package/dist/concurrent/atomic-fixnum.js +35 -0
  54. package/dist/concurrent/atomic-fixnum.js.map +1 -0
  55. package/dist/concurrent/count-down-latch.d.ts +20 -0
  56. package/dist/concurrent/count-down-latch.js +50 -0
  57. package/dist/concurrent/count-down-latch.js.map +1 -0
  58. package/dist/concurrent/cyclic-barrier.d.ts +18 -0
  59. package/dist/concurrent/cyclic-barrier.js +50 -0
  60. package/dist/concurrent/cyclic-barrier.js.map +1 -0
  61. package/dist/concurrent/event.d.ts +19 -0
  62. package/dist/concurrent/event.js +31 -0
  63. package/dist/concurrent/event.js.map +1 -0
  64. package/dist/concurrent/map.d.ts +149 -0
  65. package/dist/concurrent/map.js +202 -0
  66. package/dist/concurrent/map.js.map +1 -0
  67. package/dist/concurrent/read-write-lock.d.ts +25 -0
  68. package/dist/concurrent/read-write-lock.js +70 -0
  69. package/dist/concurrent/read-write-lock.js.map +1 -0
  70. package/dist/concurrent/semaphore.d.ts +24 -0
  71. package/dist/concurrent/semaphore.js +74 -0
  72. package/dist/concurrent/semaphore.js.map +1 -0
  73. package/dist/concurrent/timer-task.d.ts +52 -0
  74. package/dist/concurrent/timer-task.js +112 -0
  75. package/dist/concurrent/timer-task.js.map +1 -0
  76. package/dist/constants.generated.d.ts +2 -0
  77. package/dist/constants.generated.js +64 -0
  78. package/dist/constants.generated.js.map +1 -0
  79. package/dist/converter-not-found-error.d.ts +14 -0
  80. package/dist/converter-not-found-error.js +14 -0
  81. package/dist/converter-not-found-error.js.map +1 -0
  82. package/dist/crypto-adapter.d.ts +64 -0
  83. package/dist/crypto-adapter.js +365 -0
  84. package/dist/crypto-adapter.js.map +1 -0
  85. package/dist/delegate.d.ts +156 -0
  86. package/dist/delegate.js +306 -0
  87. package/dist/delegate.js.map +1 -0
  88. package/dist/digest.d.ts +99 -0
  89. package/dist/digest.js +131 -0
  90. package/dist/digest.js.map +1 -0
  91. package/dist/dir.d.ts +218 -0
  92. package/dist/dir.js +599 -0
  93. package/dist/dir.js.map +1 -0
  94. package/dist/encoding-error.d.ts +14 -0
  95. package/dist/encoding-error.js +17 -0
  96. package/dist/encoding-error.js.map +1 -0
  97. package/dist/encoding.d.ts +121 -0
  98. package/dist/encoding.js +306 -0
  99. package/dist/encoding.js.map +1 -0
  100. package/dist/ensure.d.ts +15 -0
  101. package/dist/ensure.js +35 -0
  102. package/dist/ensure.js.map +1 -0
  103. package/dist/enumerable.d.ts +375 -0
  104. package/dist/enumerable.js +1100 -0
  105. package/dist/enumerable.js.map +1 -0
  106. package/dist/enumerator.d.ts +321 -0
  107. package/dist/enumerator.js +642 -0
  108. package/dist/enumerator.js.map +1 -0
  109. package/dist/eof-error.d.ts +14 -0
  110. package/dist/eof-error.js +14 -0
  111. package/dist/eof-error.js.map +1 -0
  112. package/dist/errno.d.ts +327 -0
  113. package/dist/errno.js +452 -0
  114. package/dist/errno.js.map +1 -0
  115. package/dist/exc-detailed-message.d.ts +15 -0
  116. package/dist/exc-detailed-message.js +106 -0
  117. package/dist/exc-detailed-message.js.map +1 -0
  118. package/dist/exc-to-s.d.ts +10 -0
  119. package/dist/exc-to-s.js +21 -0
  120. package/dist/exc-to-s.js.map +1 -0
  121. package/dist/exception.d.ts +34 -0
  122. package/dist/exception.js +99 -0
  123. package/dist/exception.js.map +1 -0
  124. package/dist/fiber-error.d.ts +12 -0
  125. package/dist/fiber-error.js +12 -0
  126. package/dist/fiber-error.js.map +1 -0
  127. package/dist/fiber.d.ts +51 -0
  128. package/dist/fiber.js +178 -0
  129. package/dist/fiber.js.map +1 -0
  130. package/dist/file-utils.d.ts +480 -0
  131. package/dist/file-utils.js +1823 -0
  132. package/dist/file-utils.js.map +1 -0
  133. package/dist/file.d.ts +635 -0
  134. package/dist/file.js +1312 -0
  135. package/dist/file.js.map +1 -0
  136. package/dist/float-domain-error.d.ts +17 -0
  137. package/dist/float-domain-error.js +17 -0
  138. package/dist/float-domain-error.js.map +1 -0
  139. package/dist/fork-children.d.ts +23 -0
  140. package/dist/fork-children.js +32 -0
  141. package/dist/fork-children.js.map +1 -0
  142. package/dist/frozen-error.d.ts +33 -0
  143. package/dist/frozen-error.js +42 -0
  144. package/dist/frozen-error.js.map +1 -0
  145. package/dist/fs-adapter.d.ts +158 -0
  146. package/dist/fs-adapter.js +253 -0
  147. package/dist/fs-adapter.js.map +1 -0
  148. package/dist/gem/deprecate.d.ts +10 -0
  149. package/dist/gem/deprecate.js +8 -0
  150. package/dist/gem/deprecate.js.map +1 -0
  151. package/dist/gem/requirement.d.ts +64 -0
  152. package/dist/gem/requirement.js +91 -0
  153. package/dist/gem/requirement.js.map +1 -0
  154. package/dist/gem/version.d.ts +50 -0
  155. package/dist/gem/version.js +148 -0
  156. package/dist/gem/version.js.map +1 -0
  157. package/dist/gem.d.ts +59 -0
  158. package/dist/gem.js +82 -0
  159. package/dist/gem.js.map +1 -0
  160. package/dist/hash.d.ts +967 -0
  161. package/dist/hash.js +1572 -0
  162. package/dist/hash.js.map +1 -0
  163. package/dist/http-adapter.d.ts +123 -0
  164. package/dist/http-adapter.js +220 -0
  165. package/dist/http-adapter.js.map +1 -0
  166. package/dist/immediate-executor.d.ts +20 -0
  167. package/dist/immediate-executor.js +39 -0
  168. package/dist/immediate-executor.js.map +1 -0
  169. package/dist/include.d.ts +778 -0
  170. package/dist/include.js +2195 -0
  171. package/dist/include.js.map +1 -0
  172. package/dist/index-error.d.ts +13 -0
  173. package/dist/index-error.js +13 -0
  174. package/dist/index-error.js.map +1 -0
  175. package/dist/index.d.ts +174 -0
  176. package/dist/index.js +166 -0
  177. package/dist/index.js.map +1 -0
  178. package/dist/invalid-byte-sequence-error.d.ts +62 -0
  179. package/dist/invalid-byte-sequence-error.js +75 -0
  180. package/dist/invalid-byte-sequence-error.js.map +1 -0
  181. package/dist/io-error.d.ts +14 -0
  182. package/dist/io-error.js +17 -0
  183. package/dist/io-error.js.map +1 -0
  184. package/dist/io.d.ts +867 -0
  185. package/dist/io.js +1960 -0
  186. package/dist/io.js.map +1 -0
  187. package/dist/ipaddr.d.ts +79 -0
  188. package/dist/ipaddr.js +405 -0
  189. package/dist/ipaddr.js.map +1 -0
  190. package/dist/json.d.ts +67 -0
  191. package/dist/json.js +185 -0
  192. package/dist/json.js.map +1 -0
  193. package/dist/kernel-catch.d.ts +59 -0
  194. package/dist/kernel-catch.js +184 -0
  195. package/dist/kernel-catch.js.map +1 -0
  196. package/dist/kernel-float.d.ts +19 -0
  197. package/dist/kernel-float.js +54 -0
  198. package/dist/kernel-float.js.map +1 -0
  199. package/dist/kernel-fork.d.ts +30 -0
  200. package/dist/kernel-fork.js +72 -0
  201. package/dist/kernel-fork.js.map +1 -0
  202. package/dist/kernel-format.d.ts +27 -0
  203. package/dist/kernel-format.js +901 -0
  204. package/dist/kernel-format.js.map +1 -0
  205. package/dist/kernel-hash.d.ts +7 -0
  206. package/dist/kernel-hash.js +33 -0
  207. package/dist/kernel-hash.js.map +1 -0
  208. package/dist/kernel-integer.d.ts +49 -0
  209. package/dist/kernel-integer.js +170 -0
  210. package/dist/kernel-integer.js.map +1 -0
  211. package/dist/kernel-rand.d.ts +16 -0
  212. package/dist/kernel-rand.js +237 -0
  213. package/dist/kernel-rand.js.map +1 -0
  214. package/dist/kernel-system.d.ts +40 -0
  215. package/dist/kernel-system.js +97 -0
  216. package/dist/kernel-system.js.map +1 -0
  217. package/dist/kernel-warn.d.ts +35 -0
  218. package/dist/kernel-warn.js +73 -0
  219. package/dist/kernel-warn.js.map +1 -0
  220. package/dist/key-error.d.ts +44 -0
  221. package/dist/key-error.js +59 -0
  222. package/dist/key-error.js.map +1 -0
  223. package/dist/keyword-splat.d.ts +41 -0
  224. package/dist/keyword-splat.js +65 -0
  225. package/dist/keyword-splat.js.map +1 -0
  226. package/dist/load-error.d.ts +19 -0
  227. package/dist/load-error.js +19 -0
  228. package/dist/load-error.js.map +1 -0
  229. package/dist/load.d.ts +121 -0
  230. package/dist/load.js +263 -0
  231. package/dist/load.js.map +1 -0
  232. package/dist/loaded-features.d.ts +13 -0
  233. package/dist/loaded-features.js +15 -0
  234. package/dist/loaded-features.js.map +1 -0
  235. package/dist/local-jump-error.d.ts +12 -0
  236. package/dist/local-jump-error.js +12 -0
  237. package/dist/local-jump-error.js.map +1 -0
  238. package/dist/logger/formatter.d.ts +21 -0
  239. package/dist/logger/formatter.js +43 -0
  240. package/dist/logger/formatter.js.map +1 -0
  241. package/dist/logger/log-device.d.ts +52 -0
  242. package/dist/logger/log-device.js +104 -0
  243. package/dist/logger/log-device.js.map +1 -0
  244. package/dist/logger/severity.d.ts +23 -0
  245. package/dist/logger/severity.js +42 -0
  246. package/dist/logger/severity.js.map +1 -0
  247. package/dist/logger.d.ts +127 -0
  248. package/dist/logger.js +215 -0
  249. package/dist/logger.js.map +1 -0
  250. package/dist/marshal.d.ts +83 -0
  251. package/dist/marshal.js +1487 -0
  252. package/dist/marshal.js.map +1 -0
  253. package/dist/match-data.d.ts +161 -0
  254. package/dist/match-data.js +284 -0
  255. package/dist/match-data.js.map +1 -0
  256. package/dist/method-cache.d.ts +17 -0
  257. package/dist/method-cache.js +19 -0
  258. package/dist/method-cache.js.map +1 -0
  259. package/dist/method-missing-proxy.d.ts +53 -0
  260. package/dist/method-missing-proxy.js +154 -0
  261. package/dist/method-missing-proxy.js.map +1 -0
  262. package/dist/method.d.ts +132 -0
  263. package/dist/method.js +320 -0
  264. package/dist/method.js.map +1 -0
  265. package/dist/monitor.d.ts +114 -0
  266. package/dist/monitor.js +270 -0
  267. package/dist/monitor.js.map +1 -0
  268. package/dist/mutex.d.ts +51 -0
  269. package/dist/mutex.js +150 -0
  270. package/dist/mutex.js.map +1 -0
  271. package/dist/name-error.d.ts +45 -0
  272. package/dist/name-error.js +54 -0
  273. package/dist/name-error.js.map +1 -0
  274. package/dist/net/http/exceptions.d.ts +31 -0
  275. package/dist/net/http/exceptions.js +46 -0
  276. package/dist/net/http/exceptions.js.map +1 -0
  277. package/dist/net/http/request.d.ts +137 -0
  278. package/dist/net/http/request.js +559 -0
  279. package/dist/net/http/request.js.map +1 -0
  280. package/dist/net/http/requests.d.ts +197 -0
  281. package/dist/net/http/requests.js +197 -0
  282. package/dist/net/http/requests.js.map +1 -0
  283. package/dist/net/http/response.d.ts +141 -0
  284. package/dist/net/http/response.js +416 -0
  285. package/dist/net/http/response.js.map +1 -0
  286. package/dist/net/http/responses.d.ts +345 -0
  287. package/dist/net/http/responses.js +486 -0
  288. package/dist/net/http/responses.js.map +1 -0
  289. package/dist/net/http.d.ts +278 -0
  290. package/dist/net/http.js +760 -0
  291. package/dist/net/http.js.map +1 -0
  292. package/dist/net/protocol.d.ts +227 -0
  293. package/dist/net/protocol.js +392 -0
  294. package/dist/net/protocol.js.map +1 -0
  295. package/dist/nil-class.d.ts +10 -0
  296. package/dist/nil-class.js +27 -0
  297. package/dist/nil-class.js.map +1 -0
  298. package/dist/no-method-error.d.ts +38 -0
  299. package/dist/no-method-error.js +45 -0
  300. package/dist/no-method-error.js.map +1 -0
  301. package/dist/not-implemented-error.d.ts +13 -0
  302. package/dist/not-implemented-error.js +14 -0
  303. package/dist/not-implemented-error.js.map +1 -0
  304. package/dist/numeric.d.ts +211 -0
  305. package/dist/numeric.js +802 -0
  306. package/dist/numeric.js.map +1 -0
  307. package/dist/object-space.d.ts +34 -0
  308. package/dist/object-space.js +152 -0
  309. package/dist/object-space.js.map +1 -0
  310. package/dist/object.d.ts +908 -0
  311. package/dist/object.js +2238 -0
  312. package/dist/object.js.map +1 -0
  313. package/dist/open-uri.d.ts +180 -0
  314. package/dist/open-uri.js +402 -0
  315. package/dist/open-uri.js.map +1 -0
  316. package/dist/open3.d.ts +69 -0
  317. package/dist/open3.js +134 -0
  318. package/dist/open3.js.map +1 -0
  319. package/dist/openssl.d.ts +479 -0
  320. package/dist/openssl.js +1052 -0
  321. package/dist/openssl.js.map +1 -0
  322. package/dist/optparse.d.ts +130 -0
  323. package/dist/optparse.js +457 -0
  324. package/dist/optparse.js.map +1 -0
  325. package/dist/os-adapter.d.ts +20 -0
  326. package/dist/os-adapter.js +95 -0
  327. package/dist/os-adapter.js.map +1 -0
  328. package/dist/pathname.d.ts +71 -0
  329. package/dist/pathname.js +394 -0
  330. package/dist/pathname.js.map +1 -0
  331. package/dist/pp.d.ts +60 -0
  332. package/dist/pp.js +195 -0
  333. package/dist/pp.js.map +1 -0
  334. package/dist/pretty-print.d.ts +89 -0
  335. package/dist/pretty-print.js +232 -0
  336. package/dist/pretty-print.js.map +1 -0
  337. package/dist/process-adapter.d.ts +224 -0
  338. package/dist/process-adapter.js +878 -0
  339. package/dist/process-adapter.js.map +1 -0
  340. package/dist/process.d.ts +192 -0
  341. package/dist/process.js +403 -0
  342. package/dist/process.js.map +1 -0
  343. package/dist/psych/class-loader.d.ts +92 -0
  344. package/dist/psych/class-loader.js +139 -0
  345. package/dist/psych/class-loader.js.map +1 -0
  346. package/dist/psych/coder.d.ts +144 -0
  347. package/dist/psych/coder.js +176 -0
  348. package/dist/psych/coder.js.map +1 -0
  349. package/dist/psych/core-ext.d.ts +8 -0
  350. package/dist/psych/core-ext.js +10 -0
  351. package/dist/psych/core-ext.js.map +1 -0
  352. package/dist/psych/emitter.d.ts +116 -0
  353. package/dist/psych/emitter.js +1130 -0
  354. package/dist/psych/emitter.js.map +1 -0
  355. package/dist/psych/exception.d.ts +43 -0
  356. package/dist/psych/exception.js +54 -0
  357. package/dist/psych/exception.js.map +1 -0
  358. package/dist/psych/handler.d.ts +59 -0
  359. package/dist/psych/handler.js +95 -0
  360. package/dist/psych/handler.js.map +1 -0
  361. package/dist/psych/handlers/document-stream.d.ts +17 -0
  362. package/dist/psych/handlers/document-stream.js +26 -0
  363. package/dist/psych/handlers/document-stream.js.map +1 -0
  364. package/dist/psych/nodes/alias.d.ts +15 -0
  365. package/dist/psych/nodes/alias.js +22 -0
  366. package/dist/psych/nodes/alias.js.map +1 -0
  367. package/dist/psych/nodes/document.d.ts +23 -0
  368. package/dist/psych/nodes/document.js +35 -0
  369. package/dist/psych/nodes/document.js.map +1 -0
  370. package/dist/psych/nodes/mapping.d.ts +25 -0
  371. package/dist/psych/nodes/mapping.js +35 -0
  372. package/dist/psych/nodes/mapping.js.map +1 -0
  373. package/dist/psych/nodes/node.d.ts +59 -0
  374. package/dist/psych/nodes/node.js +79 -0
  375. package/dist/psych/nodes/node.js.map +1 -0
  376. package/dist/psych/nodes/scalar.d.ts +35 -0
  377. package/dist/psych/nodes/scalar.js +47 -0
  378. package/dist/psych/nodes/scalar.js.map +1 -0
  379. package/dist/psych/nodes/sequence.d.ts +25 -0
  380. package/dist/psych/nodes/sequence.js +35 -0
  381. package/dist/psych/nodes/sequence.js.map +1 -0
  382. package/dist/psych/nodes/stream.d.ts +23 -0
  383. package/dist/psych/nodes/stream.js +31 -0
  384. package/dist/psych/nodes/stream.js.map +1 -0
  385. package/dist/psych/omap.d.ts +9 -0
  386. package/dist/psych/omap.js +9 -0
  387. package/dist/psych/omap.js.map +1 -0
  388. package/dist/psych/parser.d.ts +41 -0
  389. package/dist/psych/parser.js +139 -0
  390. package/dist/psych/parser.js.map +1 -0
  391. package/dist/psych/scalar-scanner.d.ts +35 -0
  392. package/dist/psych/scalar-scanner.js +173 -0
  393. package/dist/psych/scalar-scanner.js.map +1 -0
  394. package/dist/psych/syntax-error.d.ts +23 -0
  395. package/dist/psych/syntax-error.js +35 -0
  396. package/dist/psych/syntax-error.js.map +1 -0
  397. package/dist/psych/tree-builder.d.ts +51 -0
  398. package/dist/psych/tree-builder.js +118 -0
  399. package/dist/psych/tree-builder.js.map +1 -0
  400. package/dist/psych/visitors/depth-first.d.ts +27 -0
  401. package/dist/psych/visitors/depth-first.js +37 -0
  402. package/dist/psych/visitors/depth-first.js.map +1 -0
  403. package/dist/psych/visitors/emitter.d.ts +32 -0
  404. package/dist/psych/visitors/emitter.js +63 -0
  405. package/dist/psych/visitors/emitter.js.map +1 -0
  406. package/dist/psych/visitors/to-ruby.d.ts +110 -0
  407. package/dist/psych/visitors/to-ruby.js +396 -0
  408. package/dist/psych/visitors/to-ruby.js.map +1 -0
  409. package/dist/psych/visitors/visitor.d.ts +11 -0
  410. package/dist/psych/visitors/visitor.js +17 -0
  411. package/dist/psych/visitors/visitor.js.map +1 -0
  412. package/dist/psych/visitors/yaml-tree.d.ts +182 -0
  413. package/dist/psych/visitors/yaml-tree.js +593 -0
  414. package/dist/psych/visitors/yaml-tree.js.map +1 -0
  415. package/dist/psych-adapter.d.ts +65 -0
  416. package/dist/psych-adapter.js +121 -0
  417. package/dist/psych-adapter.js.map +1 -0
  418. package/dist/psych-yaml.d.ts +2 -0
  419. package/dist/psych-yaml.js +5 -0
  420. package/dist/psych-yaml.js.map +1 -0
  421. package/dist/psych.d.ts +257 -0
  422. package/dist/psych.js +332 -0
  423. package/dist/psych.js.map +1 -0
  424. package/dist/queue.d.ts +129 -0
  425. package/dist/queue.js +215 -0
  426. package/dist/queue.js.map +1 -0
  427. package/dist/racc/parser.d.ts +70 -0
  428. package/dist/racc/parser.js +206 -0
  429. package/dist/racc/parser.js.map +1 -0
  430. package/dist/range-error.d.ts +15 -0
  431. package/dist/range-error.js +15 -0
  432. package/dist/range-error.js.map +1 -0
  433. package/dist/range.d.ts +166 -0
  434. package/dist/range.js +421 -0
  435. package/dist/range.js.map +1 -0
  436. package/dist/rational.d.ts +167 -0
  437. package/dist/rational.js +379 -0
  438. package/dist/rational.js.map +1 -0
  439. package/dist/rb-config.d.ts +33 -0
  440. package/dist/rb-config.js +53 -0
  441. package/dist/rb-config.js.map +1 -0
  442. package/dist/rb-equal.d.ts +66 -0
  443. package/dist/rb-equal.js +261 -0
  444. package/dist/rb-equal.js.map +1 -0
  445. package/dist/rb-hash.d.ts +26 -0
  446. package/dist/rb-hash.js +108 -0
  447. package/dist/rb-hash.js.map +1 -0
  448. package/dist/regexp.d.ts +82 -0
  449. package/dist/regexp.js +191 -0
  450. package/dist/regexp.js.map +1 -0
  451. package/dist/repl-adapter.d.ts +188 -0
  452. package/dist/repl-adapter.js +388 -0
  453. package/dist/repl-adapter.js.map +1 -0
  454. package/dist/resolv.d.ts +30 -0
  455. package/dist/resolv.js +48 -0
  456. package/dist/resolv.js.map +1 -0
  457. package/dist/ruby-empty.d.ts +28 -0
  458. package/dist/ruby-empty.js +40 -0
  459. package/dist/ruby-empty.js.map +1 -0
  460. package/dist/ruby-platform.d.ts +39 -0
  461. package/dist/ruby-platform.js +49 -0
  462. package/dist/ruby-platform.js.map +1 -0
  463. package/dist/runtime-error.d.ts +15 -0
  464. package/dist/runtime-error.js +16 -0
  465. package/dist/runtime-error.js.map +1 -0
  466. package/dist/scheduled-task.d.ts +73 -0
  467. package/dist/scheduled-task.js +150 -0
  468. package/dist/scheduled-task.js.map +1 -0
  469. package/dist/secure-random.d.ts +33 -0
  470. package/dist/secure-random.js +78 -0
  471. package/dist/secure-random.js.map +1 -0
  472. package/dist/set.d.ts +158 -0
  473. package/dist/set.js +352 -0
  474. package/dist/set.js.map +1 -0
  475. package/dist/shellwords.d.ts +27 -0
  476. package/dist/shellwords.js +53 -0
  477. package/dist/shellwords.js.map +1 -0
  478. package/dist/signal-exception.d.ts +21 -0
  479. package/dist/signal-exception.js +21 -0
  480. package/dist/signal-exception.js.map +1 -0
  481. package/dist/socket.d.ts +230 -0
  482. package/dist/socket.js +484 -0
  483. package/dist/socket.js.map +1 -0
  484. package/dist/standard-error.d.ts +18 -0
  485. package/dist/standard-error.js +23 -0
  486. package/dist/standard-error.js.map +1 -0
  487. package/dist/stop-iteration.d.ts +10 -0
  488. package/dist/stop-iteration.js +10 -0
  489. package/dist/stop-iteration.js.map +1 -0
  490. package/dist/string/b.d.ts +19 -0
  491. package/dist/string/b.js +28 -0
  492. package/dist/string/b.js.map +1 -0
  493. package/dist/string/byte-methods.d.ts +57 -0
  494. package/dist/string/byte-methods.js +266 -0
  495. package/dist/string/byte-methods.js.map +1 -0
  496. package/dist/string/bytes.d.ts +35 -0
  497. package/dist/string/bytes.js +123 -0
  498. package/dist/string/bytes.js.map +1 -0
  499. package/dist/string/case-mapping.d.ts +57 -0
  500. package/dist/string/case-mapping.js +192 -0
  501. package/dist/string/case-mapping.js.map +1 -0
  502. package/dist/string/chomp.d.ts +15 -0
  503. package/dist/string/chomp.js +32 -0
  504. package/dist/string/chomp.js.map +1 -0
  505. package/dist/string/convert.d.ts +55 -0
  506. package/dist/string/convert.js +316 -0
  507. package/dist/string/convert.js.map +1 -0
  508. package/dist/string/delete.d.ts +14 -0
  509. package/dist/string/delete.js +17 -0
  510. package/dist/string/delete.js.map +1 -0
  511. package/dist/string/each.d.ts +108 -0
  512. package/dist/string/each.js +305 -0
  513. package/dist/string/each.js.map +1 -0
  514. package/dist/string/encode.d.ts +37 -0
  515. package/dist/string/encode.js +268 -0
  516. package/dist/string/encode.js.map +1 -0
  517. package/dist/string/force-encoding.d.ts +72 -0
  518. package/dist/string/force-encoding.js +147 -0
  519. package/dist/string/force-encoding.js.map +1 -0
  520. package/dist/string/inspect.d.ts +17 -0
  521. package/dist/string/inspect.js +81 -0
  522. package/dist/string/inspect.js.map +1 -0
  523. package/dist/string/method-table.d.ts +174 -0
  524. package/dist/string/method-table.js +805 -0
  525. package/dist/string/method-table.js.map +1 -0
  526. package/dist/string/scrub.d.ts +12 -0
  527. package/dist/string/scrub.js +33 -0
  528. package/dist/string/scrub.js.map +1 -0
  529. package/dist/string/slice.d.ts +26 -0
  530. package/dist/string/slice.js +73 -0
  531. package/dist/string/slice.js.map +1 -0
  532. package/dist/string/split.d.ts +11 -0
  533. package/dist/string/split.js +44 -0
  534. package/dist/string/split.js.map +1 -0
  535. package/dist/string/sub.d.ts +114 -0
  536. package/dist/string/sub.js +371 -0
  537. package/dist/string/sub.js.map +1 -0
  538. package/dist/string/succ.d.ts +14 -0
  539. package/dist/string/succ.js +118 -0
  540. package/dist/string/succ.js.map +1 -0
  541. package/dist/string/support.d.ts +135 -0
  542. package/dist/string/support.js +283 -0
  543. package/dist/string/support.js.map +1 -0
  544. package/dist/string/tr.d.ts +46 -0
  545. package/dist/string/tr.js +156 -0
  546. package/dist/string/tr.js.map +1 -0
  547. package/dist/string-io.d.ts +166 -0
  548. package/dist/string-io.js +248 -0
  549. package/dist/string-io.js.map +1 -0
  550. package/dist/string-scanner.d.ts +133 -0
  551. package/dist/string-scanner.js +248 -0
  552. package/dist/string-scanner.js.map +1 -0
  553. package/dist/struct.d.ts +54 -0
  554. package/dist/struct.js +222 -0
  555. package/dist/struct.js.map +1 -0
  556. package/dist/symbol.d.ts +48 -0
  557. package/dist/symbol.js +107 -0
  558. package/dist/symbol.js.map +1 -0
  559. package/dist/tempfile.d.ts +173 -0
  560. package/dist/tempfile.js +290 -0
  561. package/dist/tempfile.js.map +1 -0
  562. package/dist/temporal-tag.d.ts +23 -0
  563. package/dist/temporal-tag.js +29 -0
  564. package/dist/temporal-tag.js.map +1 -0
  565. package/dist/thread-error.d.ts +13 -0
  566. package/dist/thread-error.js +13 -0
  567. package/dist/thread-error.js.map +1 -0
  568. package/dist/thread-pool-executor.d.ts +119 -0
  569. package/dist/thread-pool-executor.js +250 -0
  570. package/dist/thread-pool-executor.js.map +1 -0
  571. package/dist/thread.d.ts +211 -0
  572. package/dist/thread.js +495 -0
  573. package/dist/thread.js.map +1 -0
  574. package/dist/timeout.d.ts +29 -0
  575. package/dist/timeout.js +41 -0
  576. package/dist/timeout.js.map +1 -0
  577. package/dist/tse.d.ts +40 -0
  578. package/dist/tse.js +62 -0
  579. package/dist/tse.js.map +1 -0
  580. package/dist/type-error.d.ts +14 -0
  581. package/dist/type-error.js +15 -0
  582. package/dist/type-error.js.map +1 -0
  583. package/dist/undefined-conversion-error.d.ts +10 -0
  584. package/dist/undefined-conversion-error.js +10 -0
  585. package/dist/undefined-conversion-error.js.map +1 -0
  586. package/dist/uri/common.d.ts +209 -0
  587. package/dist/uri/common.js +369 -0
  588. package/dist/uri/common.js.map +1 -0
  589. package/dist/uri/generic.d.ts +283 -0
  590. package/dist/uri/generic.js +810 -0
  591. package/dist/uri/generic.js.map +1 -0
  592. package/dist/uri/http.d.ts +23 -0
  593. package/dist/uri/http.js +30 -0
  594. package/dist/uri/http.js.map +1 -0
  595. package/dist/uri/https.d.ts +13 -0
  596. package/dist/uri/https.js +15 -0
  597. package/dist/uri/https.js.map +1 -0
  598. package/dist/uri/rfc2396-parser.d.ts +70 -0
  599. package/dist/uri/rfc2396-parser.js +264 -0
  600. package/dist/uri/rfc2396-parser.js.map +1 -0
  601. package/dist/uri/rfc3986-parser.d.ts +46 -0
  602. package/dist/uri/rfc3986-parser.js +171 -0
  603. package/dist/uri/rfc3986-parser.js.map +1 -0
  604. package/dist/uri.d.ts +13 -0
  605. package/dist/uri.js +13 -0
  606. package/dist/uri.js.map +1 -0
  607. package/dist/variable.d.ts +183 -0
  608. package/dist/variable.js +463 -0
  609. package/dist/variable.js.map +1 -0
  610. package/dist/verbose.d.ts +21 -0
  611. package/dist/verbose.js +26 -0
  612. package/dist/verbose.js.map +1 -0
  613. package/dist/yaml.d.ts +9 -0
  614. package/dist/yaml.js +9 -0
  615. package/dist/yaml.js.map +1 -0
  616. package/dist/zlib-adapter.d.ts +117 -0
  617. package/dist/zlib-adapter.js +250 -0
  618. package/dist/zlib-adapter.js.map +1 -0
  619. package/dist/zlib.d.ts +248 -0
  620. package/dist/zlib.js +362 -0
  621. package/dist/zlib.js.map +1 -0
  622. package/package.json +82 -3
@@ -0,0 +1,379 @@
1
+ /**
2
+ * Ruby's `Rational` (`vendor/ruby/v3.3.11/rational.c:481` `nurat_s_canonicalize_internal`)
3
+ * and the `Kernel#Rational()` conversion function beside it
4
+ * (`vendor/ruby/v3.3.11/rational.c:2691` `nurat_s_convert`). Ruby has both spellings
5
+ * and Rails calls the function, so both ship here.
6
+ */
7
+ import { ArgumentError } from "./argument-error.js";
8
+ import { FloatDomainError } from "./float-domain-error.js";
9
+ import { FrozenError } from "./frozen-error.js";
10
+ import { rbIntegerTypeP } from "./numeric.js";
11
+ import { rbBuiltinClassName, rbCNumeric, rbFSend, rbInspect, rbObjClassname, rbObjIvarGet, rbObjIvarSet, rtest, } from "./object.js";
12
+ import { rbEqual } from "./rb-equal.js";
13
+ import { TypeError } from "./type-error.js";
14
+ /** Ruby core `ZeroDivisionError`, what `rb_num_zerodiv`
15
+ * (`vendor/ruby/v3.3.11/numeric.c:206`) raises for a denominator of zero.
16
+ *
17
+ * @noRailsEquivalent PERMANENT — Ruby core; Rails defines no such error. */
18
+ export class ZeroDivisionError extends Error {
19
+ constructor(message) {
20
+ super(message);
21
+ this.name = "ZeroDivisionError";
22
+ }
23
+ }
24
+ /** @internal `vendor/ruby/v3.3.11/rational.c:292` `i_gcd`, the greatest common divisor a
25
+ * Rational reduces by. */
26
+ function iGcd(x, y) {
27
+ if (x < 0n)
28
+ x = -x;
29
+ if (y < 0n)
30
+ y = -y;
31
+ while (y !== 0n) {
32
+ const t = x % y;
33
+ x = y;
34
+ y = t;
35
+ }
36
+ return x;
37
+ }
38
+ /**
39
+ * @internal `vendor/ruby/v3.3.11/rational.c:2199` `float_to_r`, which decodes a Float
40
+ * into the exact `f * 2 ** e` its bits already hold
41
+ * (`vendor/ruby/v3.3.11/numeric.c` `float_decode_internal`, i.e. `frexp`) and answers
42
+ * `f` over `2 ** -e`. A double IS a binary fraction, so doubling until the
43
+ * value is whole is that decode with no rounding in it, and it stops inside
44
+ * `Number.MAX_SAFE_INTEGER` because a mantissa is 53 bits wide. An Integer — a
45
+ * `bigint`, or a `number` `Integer#===` would accept — is itself over one, the
46
+ * `nurat_convert` Integer arm. `float_decode_internal` refuses a non-finite
47
+ * Float with a `FloatDomainError`.
48
+ */
49
+ function floatToR(x) {
50
+ if (typeof x === "bigint" || Number.isInteger(x)) {
51
+ return { numerator: BigInt(x), denominator: 1n };
52
+ }
53
+ if (!Number.isFinite(x))
54
+ throw new FloatDomainError(String(x));
55
+ let f = x;
56
+ let e = 1n;
57
+ while (!Number.isInteger(f)) {
58
+ f *= 2;
59
+ e *= 2n;
60
+ }
61
+ return { numerator: BigInt(f), denominator: e };
62
+ }
63
+ /**
64
+ * Ruby's `Rational` (`vendor/ruby/v3.3.11/rational.c`), as much of it as its callers
65
+ * need: the constructor canonicalizes to lowest terms
66
+ * (`vendor/ruby/v3.3.11/rational.c:481` `nurat_s_canonicalize_internal`), `+` adds an
67
+ * Integer (`vendor/ruby/v3.3.11/rational.c:724` `rb_rational_plus`), and
68
+ * `numerator`/`denominator` read the parts back out. A Rational stays a
69
+ * Rational under arithmetic in Ruby — on ruby 3.3.11 `(Rational(1,2) * 12).class`
70
+ * is `Rational`, `(6/1)`, and so is `Rational(9,3)` — so a ported `FIXNUM_P`
71
+ * branch is NOT reached by a reducible Rational and this class matches by
72
+ * staying a Rational too. Nothing in `rational.c` folds a denominator of one to
73
+ * an Integer; the date gem spells that fold out inline where it wants it
74
+ * (`date_parse.c:531-534`), and where a body TESTS for it it sends
75
+ * `wholenum_p`, which is a predicate, not a conversion.
76
+ *
77
+ * @noRailsEquivalent PERMANENT — Ruby core. Rails defines no Rational; it
78
+ * inherits Ruby's, and `Date._parse` answers one for a fractional-hour
79
+ * `:offset`, so trails needs the value type to answer the same.
80
+ */
81
+ export class Rational {
82
+ /** `vendor/ruby/v3.3.11/rational.c:580` `nurat_numerator` (`Rational#numerator`).
83
+ *
84
+ * Ruby's is an Integer — arbitrary precision — so a `bigint` is the JS
85
+ * analogue, not a `number`: a `number` is exact only inside
86
+ * `Number.MAX_SAFE_INTEGER` and a parsed fraction literal of more than
87
+ * sixteen digits (`date_parse.c:2319-2325`) runs straight past it.
88
+ *
89
+ * @noRailsEquivalent PERMANENT — Ruby core, part of the Rational above. */
90
+ numerator;
91
+ /** `vendor/ruby/v3.3.11/rational.c:598` `nurat_denominator` (`Rational#denominator`).
92
+ * @noRailsEquivalent PERMANENT — Ruby core, part of the Rational above. */
93
+ denominator;
94
+ /**
95
+ * `vendor/ruby/v3.3.11/rational.c:481` `nurat_s_canonicalize_internal`, the C
96
+ * constructor every `Rational` goes through — there is no public
97
+ * `Rational.new` in Ruby, so this is `rb_rational_new`
98
+ * (`vendor/ruby/v3.3.11/rational.c:1969`) rather than a method with a Ruby name.
99
+ * A Float argument goes through `float_to_r` ({@link floatToR}) — the
100
+ * `nurat_convert` division arm, so `new Rational(0.5, 86400)` is `(1/172800)`
101
+ * on ruby 3.3.11.
102
+ *
103
+ * `nurat_canonicalize` (`vendor/ruby/v3.3.11/rational.c:457`) puts the SIGN on the
104
+ * numerator before `nurat_reduce` cancels: it negates BOTH parts on a
105
+ * negative denominator, which is why `Rational(3, -4)` is `(-3/4)` on ruby
106
+ * 3.3.11 and not `(3/-4)`, and raises `rb_num_zerodiv` on a zero one.
107
+ *
108
+ * @noRailsEquivalent PERMANENT — Ruby core, part of the Rational above. */
109
+ constructor(num, den) {
110
+ const a = floatToR(num);
111
+ const b = floatToR(den);
112
+ let n = a.numerator * b.denominator;
113
+ let d = a.denominator * b.numerator;
114
+ if (d < 0n) {
115
+ n = -n;
116
+ d = -d;
117
+ }
118
+ else if (d === 0n) {
119
+ throw new ZeroDivisionError("divided by 0");
120
+ }
121
+ const g = iGcd(n, d);
122
+ this.numerator = n / g;
123
+ this.denominator = d / g;
124
+ }
125
+ /** `vendor/ruby/v3.3.11/rational.c:1075` `rb_rational_cmp` (`Rational#<=>`), which
126
+ * compares `a.num * b.den` against `b.num * a.den` — exact, where a `toF`
127
+ * comparison would not be. Its T_FLOAT arm, `f_cmp(f_to_f(self), other)`,
128
+ * takes both sides to Float instead, and it is the only arm a non-integral
129
+ * operand has.
130
+ *
131
+ * @noRailsEquivalent PERMANENT — Ruby core, part of the Rational above. */
132
+ cmp(other) {
133
+ if (typeof other === "number" && !Number.isInteger(other)) {
134
+ const f = this.toF();
135
+ return f === other ? 0 : f < other ? -1 : 1;
136
+ }
137
+ const b = other instanceof Rational ? other : new Rational(other, 1);
138
+ const a = this.numerator * b.denominator;
139
+ const c = b.numerator * this.denominator;
140
+ if (a === c)
141
+ return 0;
142
+ return a < c ? -1 : 1;
143
+ }
144
+ /** `vendor/ruby/v3.3.11/rational.c:724` `rb_rational_plus` (`Rational#+`), for the
145
+ * Integer and Rational addends this port needs.
146
+ * @noRailsEquivalent PERMANENT — Ruby core, part of the Rational above. */
147
+ add(other) {
148
+ if (other instanceof Rational) {
149
+ return new Rational(this.numerator * other.denominator + other.numerator * this.denominator, this.denominator * other.denominator);
150
+ }
151
+ return new Rational(this.numerator + BigInt(other) * this.denominator, this.denominator);
152
+ }
153
+ /** `vendor/ruby/v3.3.11/rational.c:1128` `nurat_eqeq_p` (`Rational#==`). A Float
154
+ * operand compares as a double; anything else is asked `other == self`.
155
+ * @noRailsEquivalent PERMANENT — Ruby core, part of the Rational above. */
156
+ equals(other) {
157
+ if (rbIntegerTypeP(other)) {
158
+ if (this.numerator === 0n && BigInt(other) === 0n)
159
+ return true;
160
+ if (this.denominator !== 1n)
161
+ return false;
162
+ return this.numerator === BigInt(other);
163
+ }
164
+ else if (other instanceof Number || typeof other === "number") {
165
+ return this.toF() === other.valueOf();
166
+ }
167
+ else if (other instanceof Rational) {
168
+ if (this.numerator === 0n && other.numerator === 0n)
169
+ return true;
170
+ return this.numerator === other.numerator && this.denominator === other.denominator;
171
+ }
172
+ else {
173
+ return rbEqual(other, this);
174
+ }
175
+ }
176
+ /** `vendor/ruby/v3.3.11/rational.c:1170` `nurat_coerce` (`Rational#coerce`), for the
177
+ * Integer, Float and Rational operands this port needs.
178
+ * @noRailsEquivalent PERMANENT — Ruby core, part of the Rational above. */
179
+ coerce(other) {
180
+ if (rbIntegerTypeP(other))
181
+ return [new Rational(other, 1), this];
182
+ else if (other instanceof Number || typeof other === "number")
183
+ return [other, this.toF()];
184
+ else if (other instanceof Rational)
185
+ return [other, this];
186
+ throw new TypeError(`${rbObjClassname(other)} can't be coerced into Rational`);
187
+ }
188
+ /** `vendor/ruby/v3.3.11/rational.c:861` `rb_rational_mul` (`Rational#*`), for the
189
+ * Integer multiplier this port needs. `f_muldiv`
190
+ * (`vendor/ruby/v3.3.11/rational.c:794`) cancels the multiplier against the
191
+ * denominator BEFORE it multiplies.
192
+ * @noRailsEquivalent PERMANENT — Ruby core, part of the Rational above. */
193
+ mul(other) {
194
+ const o = BigInt(other);
195
+ const g = iGcd(o, this.denominator);
196
+ return new Rational(this.numerator * (o / g), this.denominator / g);
197
+ }
198
+ /** `vendor/ruby/v3.3.11/rational.c:903` `rb_rational_div` (`Rational#/`), for the
199
+ * Integer divisor this port needs, cancelled the same way {@link mul} is.
200
+ * @noRailsEquivalent PERMANENT — Ruby core, part of the Rational above. */
201
+ quo(other) {
202
+ const o = BigInt(other);
203
+ const g = iGcd(this.numerator, o);
204
+ return new Rational(this.numerator / g, this.denominator * (o / g));
205
+ }
206
+ /** `vendor/ruby/v3.3.11/numeric.c:828` `num_zero_p` (`Rational#zero?`, inherited from
207
+ * Numeric), what `date_core.c`'s `f_zero_p` dispatches to for a Rational.
208
+ * @noRailsEquivalent PERMANENT — Ruby core, part of the Rational above. */
209
+ isZero() {
210
+ return this.numerator === 0n;
211
+ }
212
+ /** `vendor/ruby/v3.3.11/numeric.c:659` `num_div` (`Rational#div`, inherited from
213
+ * Numeric), the floored quotient — the method `date_core.c`'s `f_idiv` macro
214
+ * sends (`date_core.c:43`) — for the Integer divisor this port needs.
215
+ * @noRailsEquivalent PERMANENT — Ruby core, part of the Rational above. */
216
+ div(other) {
217
+ const den = this.denominator * BigInt(other);
218
+ const q = this.numerator / den;
219
+ return Number(this.numerator % den !== 0n && this.numerator < 0n !== den < 0n ? q - 1n : q);
220
+ }
221
+ /** `vendor/ruby/v3.3.11/numeric.c:700` `num_modulo` (`Rational#%`, inherited from
222
+ * Numeric), which is `self - other * (self.div other)` there too — what
223
+ * `date_core.c`'s `f_mod` dispatches to for a Rational — for the Integer
224
+ * and Rational divisors this port needs (`time.c`'s `modv`).
225
+ * @noRailsEquivalent PERMANENT — Ruby core, part of the Rational above. */
226
+ mod(other) {
227
+ const b = other instanceof Rational ? other : new Rational(other, 1);
228
+ const num = this.numerator * b.denominator;
229
+ const den = this.denominator * b.numerator;
230
+ const q = num / den - (num % den !== 0n && num < 0n !== den < 0n ? 1n : 0n);
231
+ return this.add(new Rational(-b.numerator * q, b.denominator));
232
+ }
233
+ /** `vendor/ruby/v3.3.11/rational.c:1278` `nurat_truncate` (`Rational#to_i`), which
234
+ * truncates toward zero.
235
+ * @noRailsEquivalent PERMANENT — Ruby core, part of the Rational above. */
236
+ toI() {
237
+ return Number(this.numerator / this.denominator);
238
+ }
239
+ /** `vendor/ruby/v3.3.11/rational.c:1287` `nurat_round_half_up` (`Rational#round`),
240
+ * which rounds half away from zero.
241
+ * @noRailsEquivalent PERMANENT — Ruby core, part of the Rational above. */
242
+ round() {
243
+ const q = this.numerator / this.denominator;
244
+ const r = this.numerator % this.denominator;
245
+ const half = (r < 0n ? -r : r) * 2n >= (this.denominator < 0n ? -this.denominator : this.denominator);
246
+ return Number(half ? q + (r < 0n !== this.denominator < 0n ? -1n : 1n) : q);
247
+ }
248
+ /** The `Float` a Rational becomes at a `number` seam —
249
+ * `vendor/ruby/v3.3.11/rational.c:1576` `nurat_to_f`, which is what every reader that
250
+ * hands the value to a floating-point API needs.
251
+ * @noRailsEquivalent PERMANENT — Ruby core, part of the Rational above. */
252
+ toF() {
253
+ return Number(this.numerator) / Number(this.denominator);
254
+ }
255
+ /** `vendor/ruby/v3.3.11/rational.c:1802` `nurat_to_s` (`Rational#to_s`).
256
+ * @noRailsEquivalent PERMANENT — Ruby core, part of the Rational above. */
257
+ toString() {
258
+ return `${this.numerator}/${this.denominator}`;
259
+ }
260
+ /** `vendor/ruby/v3.3.11/rational.c:1818` `nurat_inspect` (`Rational#inspect`), which
261
+ * parenthesizes where {@link toString} does not.
262
+ * @noRailsEquivalent PERMANENT — Ruby core, part of the Rational above. */
263
+ inspect() {
264
+ return `(${this.toString()})`;
265
+ }
266
+ /** `vendor/ruby/v3.3.11/rational.c:1857` `nurat_marshal_dump` (`Rational#marshal_dump`).
267
+ * Its `rb_copy_generic_ivar(a, self)` has no ivar table to write: a JS Array
268
+ * holds no ivars, which is why `has_ivars` (`vendor/ruby/v3.3.11/marshal.c:713`)
269
+ * counts none on one.
270
+ * @noRailsEquivalent PERMANENT — Ruby core, part of the Rational above. */
271
+ marshalDump() {
272
+ const a = [this.numerator, this.denominator];
273
+ return a;
274
+ }
275
+ }
276
+ /** @internal `vendor/ruby/v3.3.11/rational.c:439` `nurat_int_check`. It admits a
277
+ * Numeric answering `integer?`, which `nurat_canonicalize` then `assert`s is
278
+ * an Integer (`vendor/ruby/v3.3.11/rational.c:459-460`); the narrowing is that
279
+ * assertion, and `BigInt()` raises for a value that fails it. */
280
+ function nuratIntCheck(num) {
281
+ if (!rbIntegerTypeP(num)) {
282
+ if (!(num instanceof rbCNumeric) || !rtest(rbFSend(num, "isInteger"))) {
283
+ throw new TypeError("not an integer");
284
+ }
285
+ }
286
+ }
287
+ /** @internal `vendor/ruby/v3.3.11/rational.c:457` `nurat_canonicalize`, answering
288
+ * the pair its two out-parameters hold. */
289
+ function nuratCanonicalize(num, den) {
290
+ if (den < 0n) {
291
+ num = -num;
292
+ den = -den;
293
+ }
294
+ else if (den === 0n) {
295
+ throw new ZeroDivisionError("divided by 0");
296
+ }
297
+ return [num, den];
298
+ }
299
+ /** @internal `Rational::compatible` (`vendor/ruby/v3.3.11/rational.c:2806`), the
300
+ * class `Marshal.load` allocates in a Rational's place and sends `marshal_load`. */
301
+ class compatible {
302
+ /** `vendor/ruby/v3.3.11/rational.c:1869` `nurat_marshal_load`.
303
+ * @noRailsEquivalent PERMANENT */
304
+ marshalLoad(a) {
305
+ if (Object.isFrozen(this)) {
306
+ throw new FrozenError(`can't modify frozen ${rbObjClassname(this)}: ${rbInspect(this)}`);
307
+ }
308
+ if (!Array.isArray(a)) {
309
+ throw new TypeError(`wrong argument type ${rbBuiltinClassName(a)} (expected Array)`);
310
+ }
311
+ if (a.length !== 2) {
312
+ throw new ArgumentError(`marshaled rational must have an array whose length is 2 but ${a.length}`);
313
+ }
314
+ let num = a[0];
315
+ let den = a[1];
316
+ nuratIntCheck(num);
317
+ nuratIntCheck(den);
318
+ [num, den] = nuratCanonicalize(BigInt(num), BigInt(den));
319
+ rbObjIvarSet(this, "@numerator", num);
320
+ rbObjIvarSet(this, "@denominator", den);
321
+ return this;
322
+ }
323
+ }
324
+ Rational.compatible = compatible;
325
+ /**
326
+ * `vendor/ruby/v3.3.11/rational.c:1831` `nurat_dumper`.
327
+ *
328
+ * @noRailsEquivalent PERMANENT
329
+ */
330
+ export function nuratDumper(self) {
331
+ return self;
332
+ }
333
+ /**
334
+ * `vendor/ruby/v3.3.11/rational.c:1838` `nurat_loader`. `nurat_marshal_load`
335
+ * leaves the pair canonical and not reduced, and so does this.
336
+ *
337
+ * @noRailsEquivalent PERMANENT
338
+ */
339
+ export function nuratLoader(self, a) {
340
+ let num = rbObjIvarGet(a, "@numerator");
341
+ let den = rbObjIvarGet(a, "@denominator");
342
+ nuratIntCheck(num);
343
+ nuratIntCheck(den);
344
+ [num, den] = nuratCanonicalize(BigInt(num), BigInt(den));
345
+ const dat = self;
346
+ dat.numerator = num;
347
+ dat.denominator = den;
348
+ Object.freeze(self);
349
+ return self;
350
+ }
351
+ /**
352
+ * `Kernel#Rational()` — `vendor/ruby/v3.3.11/rational.c:2691` `nurat_s_convert`, whose
353
+ * `rb_scan_args(argc, argv, "11", ...)` makes the denominator optional and
354
+ * defaults it to `ONE` (`vendor/ruby/v3.3.11/rational.c:2674`) before handing both to
355
+ * `nurat_s_canonicalize_internal`. It is the spelling Rails writes — 20 call
356
+ * sites across activesupport and activerecord — and it is NOT an Integer fold:
357
+ * on ruby 3.3.11 `Rational(6, 1)` is `(6/1)` and its class is `Rational`.
358
+ *
359
+ * A Rational numerator is NOT canonicalized against the denominator:
360
+ * `nurat_convert` (`vendor/ruby/v3.3.11/rational.c:2621`) returns it unchanged for an
361
+ * exact-one denominator, and otherwise leaves the canonicalizer for `f_div`
362
+ * (`vendor/ruby/v3.3.11/rational.c:2668`), so `Rational(r, 1000000)` is a division.
363
+ *
364
+ * A non-numeric operand is converted through its `to_r`
365
+ * (`vendor/ruby/v3.3.11/rational.c:2591,2647`), and `nil` raises TypeError (`:2564-2567`).
366
+ *
367
+ * @noRailsEquivalent PERMANENT — Ruby core `Kernel#Rational()`, which Rails
368
+ * calls and does not define. */
369
+ export function rational(numv, denv = 1) {
370
+ if (numv == null)
371
+ throw new TypeError("can't convert nil into Rational");
372
+ if (typeof numv === "object" && !(numv instanceof Rational))
373
+ numv = numv.toR();
374
+ if (numv instanceof Rational) {
375
+ return denv === 1 || denv === 1n ? numv : numv.quo(denv);
376
+ }
377
+ return new Rational(numv, denv);
378
+ }
379
+ //# sourceMappingURL=rational.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rational.js","sourceRoot":"","sources":["../lib/rational.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EACL,kBAAkB,EAClB,UAAU,EACV,OAAO,EACP,SAAS,EACT,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,KAAK,GACN,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;4EAG4E;AAC5E,MAAM,OAAO,iBAAkB,SAAQ,KAA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GAAG,GAAG,IAAkD,CAAC;IAC/D,GAAG,CAAC,SAAS,GAAG,GAAa,CAAC;IAC9B,GAAG,CAAC,WAAW,GAAG,GAAa,CAAC;IAChC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEpB,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;;;;;;;;;gCAiBgC;AAChC,MAAM,UAAU,QAAQ,CACtB,IAAsD,EACtD,IAAI,GAAoB,CAAC;IAEzB,IAAI,IAAI,IAAI,IAAI;QAAE,MAAM,IAAI,SAAS,CAAC,iCAAiC,CAAC,CAAC;IACzE,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,YAAY,QAAQ,CAAC;QAAE,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC/E,IAAI,IAAI,YAAY,QAAQ,EAAE,CAAC;QAC7B,OAAO,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * `vendor/ruby/v3.3.11/tool/mkconfig.rb:21` — `RbConfig::CONFIG`, the build configuration hash Ruby's `rbconfig.rb`
3
+ * defines. Only the keys trails' ports read are answered; `EXEEXT` is the
4
+ * executable suffix a DOSISH build appends and the empty string everywhere
5
+ * else, which is what `ActiveRecord::ConnectionAdapters::AbstractAdapter
6
+ * .find_cmd_and_exec` (`abstract_adapter.rb:95`) tests for emptiness.
7
+ * `rubylibdir` is where the standard library's frames come from, which in
8
+ * Node is the `node:` scheme. `bindir` and `ruby_install_name` locate the
9
+ * running interpreter, which here is the JS runtime's executable: its
10
+ * directory, and its file name less `EXEEXT`, so that
11
+ * `File.join(bindir, ruby_install_name) + EXEEXT` is the executable's path, as
12
+ * `Thor::Util.ruby_command` (`vendor/thor/v1.4.0/lib/thor/util.rb:223-225`)
13
+ * builds it. Both are read from the process adapter on access, and are empty
14
+ * where the host names no executable.
15
+ *
16
+ * @noRailsEquivalent PERMANENT — Ruby stdlib `RbConfig`.
17
+ */
18
+ export declare const RbConfig: {
19
+ /**
20
+ * `vendor/ruby/v3.3.11/tool/mkconfig.rb:394` — the config hash itself, read as
21
+ * `RbConfig::CONFIG["EXEEXT"]` and `RbConfig::CONFIG["host_os"]`.
22
+ *
23
+ * @noRailsEquivalent PERMANENT — Ruby stdlib `RbConfig::CONFIG`.
24
+ */
25
+ readonly CONFIG: Readonly<Record<string, string>>;
26
+ /**
27
+ * `vendor/ruby/v3.3.11/tool/mkconfig.rb:391` — `RbConfig.ruby`.
28
+ *
29
+ * @noRailsEquivalent PERMANENT — Ruby stdlib `RbConfig.ruby`.
30
+ */
31
+ ruby(): string;
32
+ };
33
+ //# sourceMappingURL=rb-config.d.ts.map
@@ -0,0 +1,53 @@
1
+ import { File } from "./file.js";
2
+ import { getOs } from "./os-adapter.js";
3
+ import { getProcessAdapter } from "./process-adapter.js";
4
+ /**
5
+ * `vendor/ruby/v3.3.11/tool/mkconfig.rb:21` — `RbConfig::CONFIG`, the build configuration hash Ruby's `rbconfig.rb`
6
+ * defines. Only the keys trails' ports read are answered; `EXEEXT` is the
7
+ * executable suffix a DOSISH build appends and the empty string everywhere
8
+ * else, which is what `ActiveRecord::ConnectionAdapters::AbstractAdapter
9
+ * .find_cmd_and_exec` (`abstract_adapter.rb:95`) tests for emptiness.
10
+ * `rubylibdir` is where the standard library's frames come from, which in
11
+ * Node is the `node:` scheme. `bindir` and `ruby_install_name` locate the
12
+ * running interpreter, which here is the JS runtime's executable: its
13
+ * directory, and its file name less `EXEEXT`, so that
14
+ * `File.join(bindir, ruby_install_name) + EXEEXT` is the executable's path, as
15
+ * `Thor::Util.ruby_command` (`vendor/thor/v1.4.0/lib/thor/util.rb:223-225`)
16
+ * builds it. Both are read from the process adapter on access, and are empty
17
+ * where the host names no executable.
18
+ *
19
+ * @noRailsEquivalent PERMANENT — Ruby stdlib `RbConfig`.
20
+ */
21
+ export const RbConfig = {
22
+ /**
23
+ * `vendor/ruby/v3.3.11/tool/mkconfig.rb:394` — the config hash itself, read as
24
+ * `RbConfig::CONFIG["EXEEXT"]` and `RbConfig::CONFIG["host_os"]`.
25
+ *
26
+ * @noRailsEquivalent PERMANENT — Ruby stdlib `RbConfig::CONFIG`.
27
+ */
28
+ get CONFIG() {
29
+ const platform = getOs().platform();
30
+ const EXEEXT = platform === "win32" ? ".exe" : "";
31
+ const execPath = () => getProcessAdapter().execPath?.() ?? "";
32
+ return {
33
+ EXEEXT,
34
+ host_os: platform === "win32" ? "mingw32" : platform,
35
+ rubylibdir: "node:",
36
+ get bindir() {
37
+ return execPath() === "" ? "" : File.dirname(execPath());
38
+ },
39
+ get ruby_install_name() {
40
+ return File.basename(execPath(), EXEEXT);
41
+ },
42
+ };
43
+ },
44
+ /**
45
+ * `vendor/ruby/v3.3.11/tool/mkconfig.rb:391` — `RbConfig.ruby`.
46
+ *
47
+ * @noRailsEquivalent PERMANENT — Ruby stdlib `RbConfig.ruby`.
48
+ */
49
+ ruby() {
50
+ return File.join(RbConfig.CONFIG["bindir"], RbConfig.CONFIG["ruby_install_name"] + RbConfig.CONFIG["EXEEXT"]);
51
+ },
52
+ };
53
+ //# sourceMappingURL=rb-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rb-config.js","sourceRoot":"","sources":["../lib/rb-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB;;;;;OAKG;IACH,IAAI,MAAM;QACR,MAAM,QAAQ,GAAG,KAAK,EAAE,CAAC,QAAQ,EAAE,CAAC;QACpC,MAAM,MAAM,GAAG,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QAClD,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,iBAAiB,EAAE,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC;QAC9D,OAAO;YACL,MAAM;YACN,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;YACpD,UAAU,EAAE,OAAO;YACnB,IAAI,MAAM;gBACR,OAAO,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC3D,CAAC;YACD,IAAI,iBAAiB;gBACnB,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC;YAC3C,CAAC;SACF,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,IAAI;QACF,OAAO,IAAI,CAAC,IAAI,CACd,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,EACzB,QAAQ,CAAC,MAAM,CAAC,mBAAmB,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CACjE,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Ruby's `rb_equal` (`vendor/ruby/v3.3.11/object.c:147`) — the C primitive behind every `==` send: identity first,
3
+ * then the receiver's own `==`. Ported callers (`Range#==`'s endpoint
4
+ * comparison, `Duration#==`'s non-Duration arm) all need the same dispatch,
5
+ * and JS `===` only covers its first arm.
6
+ *
7
+ * `rb_str_equal` (`vendor/ruby/v3.3.11/string.c:3742`) compares a UTF-8 String
8
+ * with a binary one, whose seat is a `Uint8Array`, only where
9
+ * `rb_str_comparable` (`string.c:3671`) allows it, which is when one of them is
10
+ * 7-bit, and then by their bytes.
11
+ *
12
+ * @noRailsEquivalent PERMANENT — `rb_equal` is a C primitive
13
+ * (`vendor/ruby/v3.3.11/object.c:147`), not a
14
+ * Ruby method, so it has no counterpart file; JS has no `==` send at all, so
15
+ * one copy serves every ported `==`.
16
+ */
17
+ export declare function rbEqual(a: unknown, b: unknown): boolean;
18
+ /**
19
+ * Ruby's `rb_eql` (`vendor/ruby/v3.3.11/object.c:159`) — the C primitive behind every
20
+ * `eql?` send, and the equality a Hash keys on. It is `rb_equal` with one arm
21
+ * removed: `Kernel#eql?` defaults to `rb_obj_equal`
22
+ * (`vendor/ruby/v3.3.11/object.c:4374`), identity, so a class that defines `==` and no
23
+ * `eql?` is `eql?` only to itself, where `==` may answer true. The value
24
+ * classes that override it — String, Array, Hash, Integer, Date, Time — are
25
+ * shared with `rb_equal` and compare the same, which is why MRI threads the
26
+ * difference as a flag through one body (`hash_equal`'s `int eql`,
27
+ * `vendor/ruby/v3.3.11/hash.c:3746`) rather than writing the walk twice.
28
+ *
29
+ * @noRailsEquivalent PERMANENT — `rb_eql` is a C primitive
30
+ * (`vendor/ruby/v3.3.11/object.c:159`), not a Ruby method, so it has no counterpart
31
+ * file; JS has no `eql?` send at all, so one copy serves every ported
32
+ * `eql?`.
33
+ */
34
+ export declare function rbEql(a: unknown, b: unknown): boolean;
35
+ /**
36
+ * The `RHASH` of `hash_equal` (`vendor/ruby/v3.3.11/hash.c:3746`) over both JS seats.
37
+ *
38
+ * @noRailsEquivalent PERMANENT
39
+ */
40
+ export declare function hashEntries(value: unknown): [unknown, unknown][] | null;
41
+ /**
42
+ * The `===` send (`rb_funcall(pattern, idEqq, 1, target)`, what
43
+ * `check_match` issues for a `case`/`when`, `vendor/ruby/v3.3.11/vm_insnhelper.c:2445-2446`),
44
+ * dispatched over the JS seats of the classes that define it: a receiver's own
45
+ * `caseEquals` (Range's `range_eqq`, `vendor/ruby/v3.3.11/range.c:2644`), Regexp's
46
+ * `rb_reg_eqq` (`vendor/ruby/v3.3.11/re.c:3676`, a non-String operand is `false`),
47
+ * Set's `include?` alias, `Module#===` (`rb_mod_eqq`, `vendor/ruby/v3.3.11/object.c:1771`)
48
+ * for a constructor, `Proc#===` (`proc_call`, `vendor/ruby/v3.3.11/proc.c:4302`) for
49
+ * any other function, and `Kernel#===` (`case_equal`, `object.c:4372`), which
50
+ * is `rb_equal`, for everything else.
51
+ *
52
+ * @noRailsEquivalent PERMANENT — the `===` send is a C method dispatch
53
+ * (`vendor/ruby/v3.3.11/vm_insnhelper.c:2446`); JS has no `===` send at all, so one
54
+ * copy serves every ported `===`.
55
+ */
56
+ export declare function rbEqq(pattern: unknown, target: unknown): boolean;
57
+ /**
58
+ * `k_date_p` (`vendor/ruby/v3.3.11/ext/date/date_core.c:1992`), `f_kind_of_p(x, cDate)`.
59
+ * Read off `rbObjClass` rather than `rbObjIsKindOf`, whose module would close an
60
+ * import cycle through include.ts.
61
+ *
62
+ * @internal
63
+ * @noRailsEquivalent PERMANENT
64
+ */
65
+ export declare function kDateP(x: unknown): boolean;
66
+ //# sourceMappingURL=rb-equal.d.ts.map