@blazetrails/ruby-compat 0.0.0-stage → 0.1.0-alpha0.2

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 (625) 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 +78 -0
  14. package/dist/backtrace-location.js +158 -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 +111 -0
  23. package/dist/big-decimal.js +584 -0
  24. package/dist/big-decimal.js.map +1 -0
  25. package/dist/bundler.d.ts +44 -0
  26. package/dist/bundler.js +97 -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 +93 -0
  38. package/dist/classpath.js +210 -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 +49 -0
  47. package/dist/complex.js +164 -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 +225 -0
  92. package/dist/dir.js +608 -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 +1102 -0
  105. package/dist/enumerable.js.map +1 -0
  106. package/dist/enumerator.d.ts +324 -0
  107. package/dist/enumerator.js +625 -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 +447 -0
  113. package/dist/errno.js +616 -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 +44 -0
  122. package/dist/exception.js +115 -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 +1824 -0
  132. package/dist/file-utils.js.map +1 -0
  133. package/dist/file.d.ts +643 -0
  134. package/dist/file.js +1334 -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 +41 -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 +55 -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 +124 -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 +2208 -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 +70 -0
  191. package/dist/json.js +181 -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 +39 -0
  215. package/dist/kernel-system.js +103 -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 +128 -0
  230. package/dist/load.js +278 -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 +218 -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 +81 -0
  257. package/dist/method-cache.js +109 -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 +13 -0
  303. package/dist/not-implemented-error.js.map +1 -0
  304. package/dist/numeric-class.d.ts +29 -0
  305. package/dist/numeric-class.js +41 -0
  306. package/dist/numeric-class.js.map +1 -0
  307. package/dist/numeric.d.ts +226 -0
  308. package/dist/numeric.js +848 -0
  309. package/dist/numeric.js.map +1 -0
  310. package/dist/object-space.d.ts +34 -0
  311. package/dist/object-space.js +152 -0
  312. package/dist/object-space.js.map +1 -0
  313. package/dist/object.d.ts +833 -0
  314. package/dist/object.js +2131 -0
  315. package/dist/object.js.map +1 -0
  316. package/dist/open-uri.d.ts +180 -0
  317. package/dist/open-uri.js +402 -0
  318. package/dist/open-uri.js.map +1 -0
  319. package/dist/open3.d.ts +69 -0
  320. package/dist/open3.js +134 -0
  321. package/dist/open3.js.map +1 -0
  322. package/dist/openssl.d.ts +479 -0
  323. package/dist/openssl.js +1052 -0
  324. package/dist/openssl.js.map +1 -0
  325. package/dist/optparse.d.ts +130 -0
  326. package/dist/optparse.js +457 -0
  327. package/dist/optparse.js.map +1 -0
  328. package/dist/os-adapter.d.ts +20 -0
  329. package/dist/os-adapter.js +95 -0
  330. package/dist/os-adapter.js.map +1 -0
  331. package/dist/pathname.d.ts +73 -0
  332. package/dist/pathname.js +412 -0
  333. package/dist/pathname.js.map +1 -0
  334. package/dist/pp.d.ts +60 -0
  335. package/dist/pp.js +195 -0
  336. package/dist/pp.js.map +1 -0
  337. package/dist/pretty-print.d.ts +89 -0
  338. package/dist/pretty-print.js +232 -0
  339. package/dist/pretty-print.js.map +1 -0
  340. package/dist/process-adapter.d.ts +229 -0
  341. package/dist/process-adapter.js +889 -0
  342. package/dist/process-adapter.js.map +1 -0
  343. package/dist/process.d.ts +202 -0
  344. package/dist/process.js +433 -0
  345. package/dist/process.js.map +1 -0
  346. package/dist/psych/class-loader.d.ts +92 -0
  347. package/dist/psych/class-loader.js +139 -0
  348. package/dist/psych/class-loader.js.map +1 -0
  349. package/dist/psych/coder.d.ts +144 -0
  350. package/dist/psych/coder.js +176 -0
  351. package/dist/psych/coder.js.map +1 -0
  352. package/dist/psych/core-ext.d.ts +8 -0
  353. package/dist/psych/core-ext.js +10 -0
  354. package/dist/psych/core-ext.js.map +1 -0
  355. package/dist/psych/emitter.d.ts +116 -0
  356. package/dist/psych/emitter.js +1130 -0
  357. package/dist/psych/emitter.js.map +1 -0
  358. package/dist/psych/exception.d.ts +43 -0
  359. package/dist/psych/exception.js +54 -0
  360. package/dist/psych/exception.js.map +1 -0
  361. package/dist/psych/handler.d.ts +59 -0
  362. package/dist/psych/handler.js +95 -0
  363. package/dist/psych/handler.js.map +1 -0
  364. package/dist/psych/handlers/document-stream.d.ts +17 -0
  365. package/dist/psych/handlers/document-stream.js +26 -0
  366. package/dist/psych/handlers/document-stream.js.map +1 -0
  367. package/dist/psych/nodes/alias.d.ts +15 -0
  368. package/dist/psych/nodes/alias.js +22 -0
  369. package/dist/psych/nodes/alias.js.map +1 -0
  370. package/dist/psych/nodes/document.d.ts +23 -0
  371. package/dist/psych/nodes/document.js +35 -0
  372. package/dist/psych/nodes/document.js.map +1 -0
  373. package/dist/psych/nodes/mapping.d.ts +25 -0
  374. package/dist/psych/nodes/mapping.js +35 -0
  375. package/dist/psych/nodes/mapping.js.map +1 -0
  376. package/dist/psych/nodes/node.d.ts +59 -0
  377. package/dist/psych/nodes/node.js +79 -0
  378. package/dist/psych/nodes/node.js.map +1 -0
  379. package/dist/psych/nodes/scalar.d.ts +35 -0
  380. package/dist/psych/nodes/scalar.js +47 -0
  381. package/dist/psych/nodes/scalar.js.map +1 -0
  382. package/dist/psych/nodes/sequence.d.ts +25 -0
  383. package/dist/psych/nodes/sequence.js +35 -0
  384. package/dist/psych/nodes/sequence.js.map +1 -0
  385. package/dist/psych/nodes/stream.d.ts +23 -0
  386. package/dist/psych/nodes/stream.js +31 -0
  387. package/dist/psych/nodes/stream.js.map +1 -0
  388. package/dist/psych/omap.d.ts +9 -0
  389. package/dist/psych/omap.js +9 -0
  390. package/dist/psych/omap.js.map +1 -0
  391. package/dist/psych/parser.d.ts +41 -0
  392. package/dist/psych/parser.js +139 -0
  393. package/dist/psych/parser.js.map +1 -0
  394. package/dist/psych/scalar-scanner.d.ts +31 -0
  395. package/dist/psych/scalar-scanner.js +169 -0
  396. package/dist/psych/scalar-scanner.js.map +1 -0
  397. package/dist/psych/syntax-error.d.ts +23 -0
  398. package/dist/psych/syntax-error.js +35 -0
  399. package/dist/psych/syntax-error.js.map +1 -0
  400. package/dist/psych/tree-builder.d.ts +51 -0
  401. package/dist/psych/tree-builder.js +118 -0
  402. package/dist/psych/tree-builder.js.map +1 -0
  403. package/dist/psych/visitors/depth-first.d.ts +27 -0
  404. package/dist/psych/visitors/depth-first.js +37 -0
  405. package/dist/psych/visitors/depth-first.js.map +1 -0
  406. package/dist/psych/visitors/emitter.d.ts +32 -0
  407. package/dist/psych/visitors/emitter.js +63 -0
  408. package/dist/psych/visitors/emitter.js.map +1 -0
  409. package/dist/psych/visitors/to-ruby.d.ts +110 -0
  410. package/dist/psych/visitors/to-ruby.js +396 -0
  411. package/dist/psych/visitors/to-ruby.js.map +1 -0
  412. package/dist/psych/visitors/visitor.d.ts +11 -0
  413. package/dist/psych/visitors/visitor.js +17 -0
  414. package/dist/psych/visitors/visitor.js.map +1 -0
  415. package/dist/psych/visitors/yaml-tree.d.ts +182 -0
  416. package/dist/psych/visitors/yaml-tree.js +593 -0
  417. package/dist/psych/visitors/yaml-tree.js.map +1 -0
  418. package/dist/psych-adapter.d.ts +65 -0
  419. package/dist/psych-adapter.js +121 -0
  420. package/dist/psych-adapter.js.map +1 -0
  421. package/dist/psych-yaml.d.ts +2 -0
  422. package/dist/psych-yaml.js +5 -0
  423. package/dist/psych-yaml.js.map +1 -0
  424. package/dist/psych.d.ts +257 -0
  425. package/dist/psych.js +332 -0
  426. package/dist/psych.js.map +1 -0
  427. package/dist/queue.d.ts +137 -0
  428. package/dist/queue.js +236 -0
  429. package/dist/queue.js.map +1 -0
  430. package/dist/racc/parser.d.ts +70 -0
  431. package/dist/racc/parser.js +206 -0
  432. package/dist/racc/parser.js.map +1 -0
  433. package/dist/range-error.d.ts +15 -0
  434. package/dist/range-error.js +15 -0
  435. package/dist/range-error.js.map +1 -0
  436. package/dist/range.d.ts +166 -0
  437. package/dist/range.js +421 -0
  438. package/dist/range.js.map +1 -0
  439. package/dist/rational.d.ts +168 -0
  440. package/dist/rational.js +587 -0
  441. package/dist/rational.js.map +1 -0
  442. package/dist/rb-config.d.ts +33 -0
  443. package/dist/rb-config.js +53 -0
  444. package/dist/rb-config.js.map +1 -0
  445. package/dist/rb-equal.d.ts +66 -0
  446. package/dist/rb-equal.js +262 -0
  447. package/dist/rb-equal.js.map +1 -0
  448. package/dist/rb-hash.d.ts +26 -0
  449. package/dist/rb-hash.js +108 -0
  450. package/dist/rb-hash.js.map +1 -0
  451. package/dist/regexp.d.ts +82 -0
  452. package/dist/regexp.js +191 -0
  453. package/dist/regexp.js.map +1 -0
  454. package/dist/repl-adapter.d.ts +270 -0
  455. package/dist/repl-adapter.js +562 -0
  456. package/dist/repl-adapter.js.map +1 -0
  457. package/dist/resolv.d.ts +30 -0
  458. package/dist/resolv.js +48 -0
  459. package/dist/resolv.js.map +1 -0
  460. package/dist/ruby-empty.d.ts +28 -0
  461. package/dist/ruby-empty.js +40 -0
  462. package/dist/ruby-empty.js.map +1 -0
  463. package/dist/ruby-platform.d.ts +39 -0
  464. package/dist/ruby-platform.js +49 -0
  465. package/dist/ruby-platform.js.map +1 -0
  466. package/dist/runtime-error.d.ts +15 -0
  467. package/dist/runtime-error.js +15 -0
  468. package/dist/runtime-error.js.map +1 -0
  469. package/dist/scheduled-task.d.ts +73 -0
  470. package/dist/scheduled-task.js +150 -0
  471. package/dist/scheduled-task.js.map +1 -0
  472. package/dist/secure-random.d.ts +50 -0
  473. package/dist/secure-random.js +141 -0
  474. package/dist/secure-random.js.map +1 -0
  475. package/dist/set.d.ts +158 -0
  476. package/dist/set.js +352 -0
  477. package/dist/set.js.map +1 -0
  478. package/dist/shellwords.d.ts +27 -0
  479. package/dist/shellwords.js +53 -0
  480. package/dist/shellwords.js.map +1 -0
  481. package/dist/signal-exception.d.ts +43 -0
  482. package/dist/signal-exception.js +88 -0
  483. package/dist/signal-exception.js.map +1 -0
  484. package/dist/socket.d.ts +230 -0
  485. package/dist/socket.js +484 -0
  486. package/dist/socket.js.map +1 -0
  487. package/dist/standard-error.d.ts +27 -0
  488. package/dist/standard-error.js +49 -0
  489. package/dist/standard-error.js.map +1 -0
  490. package/dist/stop-iteration.d.ts +10 -0
  491. package/dist/stop-iteration.js +10 -0
  492. package/dist/stop-iteration.js.map +1 -0
  493. package/dist/string/b.d.ts +19 -0
  494. package/dist/string/b.js +28 -0
  495. package/dist/string/b.js.map +1 -0
  496. package/dist/string/byte-methods.d.ts +57 -0
  497. package/dist/string/byte-methods.js +266 -0
  498. package/dist/string/byte-methods.js.map +1 -0
  499. package/dist/string/bytes.d.ts +35 -0
  500. package/dist/string/bytes.js +123 -0
  501. package/dist/string/bytes.js.map +1 -0
  502. package/dist/string/case-mapping.d.ts +57 -0
  503. package/dist/string/case-mapping.js +192 -0
  504. package/dist/string/case-mapping.js.map +1 -0
  505. package/dist/string/chomp.d.ts +15 -0
  506. package/dist/string/chomp.js +32 -0
  507. package/dist/string/chomp.js.map +1 -0
  508. package/dist/string/convert.d.ts +55 -0
  509. package/dist/string/convert.js +316 -0
  510. package/dist/string/convert.js.map +1 -0
  511. package/dist/string/delete.d.ts +14 -0
  512. package/dist/string/delete.js +17 -0
  513. package/dist/string/delete.js.map +1 -0
  514. package/dist/string/each.d.ts +108 -0
  515. package/dist/string/each.js +305 -0
  516. package/dist/string/each.js.map +1 -0
  517. package/dist/string/encode.d.ts +37 -0
  518. package/dist/string/encode.js +268 -0
  519. package/dist/string/encode.js.map +1 -0
  520. package/dist/string/force-encoding.d.ts +72 -0
  521. package/dist/string/force-encoding.js +147 -0
  522. package/dist/string/force-encoding.js.map +1 -0
  523. package/dist/string/inspect.d.ts +17 -0
  524. package/dist/string/inspect.js +81 -0
  525. package/dist/string/inspect.js.map +1 -0
  526. package/dist/string/method-table.d.ts +174 -0
  527. package/dist/string/method-table.js +805 -0
  528. package/dist/string/method-table.js.map +1 -0
  529. package/dist/string/scrub.d.ts +12 -0
  530. package/dist/string/scrub.js +33 -0
  531. package/dist/string/scrub.js.map +1 -0
  532. package/dist/string/slice.d.ts +26 -0
  533. package/dist/string/slice.js +73 -0
  534. package/dist/string/slice.js.map +1 -0
  535. package/dist/string/split.d.ts +11 -0
  536. package/dist/string/split.js +44 -0
  537. package/dist/string/split.js.map +1 -0
  538. package/dist/string/sub.d.ts +114 -0
  539. package/dist/string/sub.js +371 -0
  540. package/dist/string/sub.js.map +1 -0
  541. package/dist/string/succ.d.ts +14 -0
  542. package/dist/string/succ.js +118 -0
  543. package/dist/string/succ.js.map +1 -0
  544. package/dist/string/support.d.ts +142 -0
  545. package/dist/string/support.js +296 -0
  546. package/dist/string/support.js.map +1 -0
  547. package/dist/string/tr.d.ts +46 -0
  548. package/dist/string/tr.js +156 -0
  549. package/dist/string/tr.js.map +1 -0
  550. package/dist/string-io.d.ts +166 -0
  551. package/dist/string-io.js +248 -0
  552. package/dist/string-io.js.map +1 -0
  553. package/dist/string-scanner.d.ts +133 -0
  554. package/dist/string-scanner.js +248 -0
  555. package/dist/string-scanner.js.map +1 -0
  556. package/dist/struct.d.ts +54 -0
  557. package/dist/struct.js +222 -0
  558. package/dist/struct.js.map +1 -0
  559. package/dist/symbol.d.ts +48 -0
  560. package/dist/symbol.js +107 -0
  561. package/dist/symbol.js.map +1 -0
  562. package/dist/tempfile.d.ts +173 -0
  563. package/dist/tempfile.js +295 -0
  564. package/dist/tempfile.js.map +1 -0
  565. package/dist/temporal-tag.d.ts +23 -0
  566. package/dist/temporal-tag.js +29 -0
  567. package/dist/temporal-tag.js.map +1 -0
  568. package/dist/thread-error.d.ts +13 -0
  569. package/dist/thread-error.js +13 -0
  570. package/dist/thread-error.js.map +1 -0
  571. package/dist/thread-pool-executor.d.ts +121 -0
  572. package/dist/thread-pool-executor.js +254 -0
  573. package/dist/thread-pool-executor.js.map +1 -0
  574. package/dist/thread.d.ts +211 -0
  575. package/dist/thread.js +495 -0
  576. package/dist/thread.js.map +1 -0
  577. package/dist/timeout.d.ts +29 -0
  578. package/dist/timeout.js +41 -0
  579. package/dist/timeout.js.map +1 -0
  580. package/dist/tse.d.ts +40 -0
  581. package/dist/tse.js +66 -0
  582. package/dist/tse.js.map +1 -0
  583. package/dist/type-error.d.ts +14 -0
  584. package/dist/type-error.js +14 -0
  585. package/dist/type-error.js.map +1 -0
  586. package/dist/undefined-conversion-error.d.ts +10 -0
  587. package/dist/undefined-conversion-error.js +10 -0
  588. package/dist/undefined-conversion-error.js.map +1 -0
  589. package/dist/uri/common.d.ts +209 -0
  590. package/dist/uri/common.js +369 -0
  591. package/dist/uri/common.js.map +1 -0
  592. package/dist/uri/generic.d.ts +280 -0
  593. package/dist/uri/generic.js +806 -0
  594. package/dist/uri/generic.js.map +1 -0
  595. package/dist/uri/http.d.ts +23 -0
  596. package/dist/uri/http.js +30 -0
  597. package/dist/uri/http.js.map +1 -0
  598. package/dist/uri/https.d.ts +13 -0
  599. package/dist/uri/https.js +15 -0
  600. package/dist/uri/https.js.map +1 -0
  601. package/dist/uri/rfc2396-parser.d.ts +70 -0
  602. package/dist/uri/rfc2396-parser.js +264 -0
  603. package/dist/uri/rfc2396-parser.js.map +1 -0
  604. package/dist/uri/rfc3986-parser.d.ts +46 -0
  605. package/dist/uri/rfc3986-parser.js +171 -0
  606. package/dist/uri/rfc3986-parser.js.map +1 -0
  607. package/dist/uri.d.ts +13 -0
  608. package/dist/uri.js +13 -0
  609. package/dist/uri.js.map +1 -0
  610. package/dist/variable.d.ts +183 -0
  611. package/dist/variable.js +463 -0
  612. package/dist/variable.js.map +1 -0
  613. package/dist/verbose.d.ts +39 -0
  614. package/dist/verbose.js +49 -0
  615. package/dist/verbose.js.map +1 -0
  616. package/dist/yaml.d.ts +9 -0
  617. package/dist/yaml.js +9 -0
  618. package/dist/yaml.js.map +1 -0
  619. package/dist/zlib-adapter.d.ts +119 -0
  620. package/dist/zlib-adapter.js +230 -0
  621. package/dist/zlib-adapter.js.map +1 -0
  622. package/dist/zlib.d.ts +299 -0
  623. package/dist/zlib.js +679 -0
  624. package/dist/zlib.js.map +1 -0
  625. package/package.json +172 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Dean Marano and Trails contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/NOTICE ADDED
@@ -0,0 +1,6 @@
1
+ @blazetrails/ruby-compat
2
+ ========================
3
+
4
+ This package is a TypeScript port of Ruby core and stdlib primitives from
5
+ ruby/ruby (https://github.com/ruby/ruby), licensed under the Ruby License /
6
+ 2-clause BSDL. The MRI read-anchor is vendored at `vendor/ruby/`.
package/README.md CHANGED
@@ -1,3 +1,441 @@
1
- # Temporary Holding Version
1
+ # @blazetrails/ruby-compat
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Ruby core and stdlib primitives that trails calls but Rails does not define.
4
+
5
+ Rails is written against Ruby. A port of Rails therefore needs pieces of Ruby
6
+ itself — `Object#blank?`'s notion of whitespace, `String#succ`'s carry,
7
+ `Hash#fetch`'s stored-`nil` semantics, `Rational` canonicalization — and those
8
+ pieces have no Rails counterpart to mirror. Historically they accumulated inside
9
+ `@blazetrails/activesupport`, which inverted the real dependency: ActiveSupport
10
+ is a Rails gem that _uses_ Ruby, not the place Ruby lives. This package is where
11
+ they belong instead.
12
+
13
+ Its upstream is [ruby/ruby](https://github.com/ruby/ruby), vendored at
14
+ `vendor/ruby/v3.3.11/` (RFC 0129). Read the C or the Ruby there before writing
15
+ anything here, the same way every other package reads `vendor/rails/` first.
16
+
17
+ Every other package depends on this one, and it depends on nothing in the
18
+ workspace (rule 4). It is not a general Ruby runtime: a member exists only
19
+ because some other package calls it (rule 1).
20
+
21
+ ## Using it
22
+
23
+ Most users never import it directly; the framework packages do. What a trails
24
+ application does touch is the host-adapter layer and a few Ruby values that
25
+ cross the API boundary:
26
+
27
+ ```ts
28
+ import { Range, env, setEnv } from "@blazetrails/ruby-compat";
29
+
30
+ new Range(1, 10).isInclude(5); // true: Ruby's Range#include?
31
+ setEnv("TRAILS_ENV", "test"); // ENV["TRAILS_ENV"] = "test", through the process adapter
32
+ env.TRAILS_ENV; // "test"
33
+ ```
34
+
35
+ The subpath exports `./include`, `./method-missing-proxy`, `./name-error` and
36
+ `./range` exist for the packages that need those modules without loading the
37
+ barrel.
38
+
39
+ ## What is here
40
+
41
+ About 110 modules, grouped by the MRI area they port:
42
+
43
+ | area | modules |
44
+ | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
45
+ | Object model | `include` / `extend` / `prepend` (`Module#include` and friends, `included` / `extended` hooks), `Method`, `rbObjRespondTo` / `basicObjRespondTo`, `rbFSend`, `rbModPrivate` / `rbModProtected` visibility, `rbObjSingletonClass`, `methodMissingPrototype`, `ObjectSpace` |
46
+ | Equality, hashing, ordering | `rbEqual` / `rbEql` / `rbEqq`, `rbHash`, `Comparable` (`cmp`, `isBetween`, …), `Enumerable`, `Enumerator` / `toEnum` |
47
+ | Core values | `Range`, `Rational`, `BigDecimal`, `NilClass`, numeric helpers (`round`, `toI`, `anybits`), `Kernel#Integer` / `Float` / `format` / `rand` / `catch` |
48
+ | String, Symbol, Regexp | `succ`, `chomp`, `scrub`, `byteslice`, `split`, `inspect`, `force_encoding`, `Encoding`, `StringScanner`, `StringIO`, `MatchData`, `regexpEscape`, Symbol helpers |
49
+ | Array, Hash | Ruby `Array` methods (`pack`, `unpack1`, `slice`, `uniq`, …) and `Hash` methods with Ruby semantics (`fetch`, `merge`, `except`, default procs, …) |
50
+ | Exceptions | `Exception`, `StandardError`, `ArgumentError`, `NameError`, `NoMethodError`, `TypeError`, `KeyError`, `FrozenError`, `ZeroDivisionError`, …, and `Location` / `excBacktraceLocations` for backtraces |
51
+ | Concurrency | `Monitor` / `synchronize` / `MonitorMixin`, `Mutex`, `Thread`, `Fiber`, `ThreadPoolExecutor` |
52
+ | Stdlib | `Marshal`, `Psych`, `PP` / `PrettyPrint`, `Open3`, `File`, `Dir`, `FileUtils`, `IO`, `Tempfile`, `JSON`, `Base64`, `Digest`, `OpenSSL` (`Cipher`, `HMAC`), `SecureRandom`, `Zlib`, `URI`, `IPAddr`, `Gem`, `RbConfig`, `Process` |
53
+ | Host adapters | Pluggable backends for the host runtime: `registerFsAdapter`, `registerCryptoAdapter`, `registerProcessAdapter`, `registerZlibAdapter`, `registerHttpAdapter`, `registerOsAdapter`, `registerChildProcessAdapter`, `registerAsyncContextAdapter`. Node implementations are the default. |
54
+
55
+ `src/index.ts` is the complete list.
56
+
57
+ ### Call sites for the first exports
58
+
59
+ The table below covers a subset of the exports, with the call site that
60
+ justifies each (rule 1). Extending it to
61
+ every export is part of `ruby-compat-rule-1-call-site-gate` (RFC 0154), which
62
+ also puts rule 1 under a gate.
63
+
64
+ | export | MRI anchor | call sites |
65
+ | ----------------------------------------------------------------------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
66
+ | `regexpEscape` | `re.c:4144` `rb_reg_s_quote` | `activerecord/test/support/quote-regex.ts`, `run-token.ts`, `trailties/lib/generators/trails-actions.ts` |
67
+ | `rbRegMatchP` | `re.c:3811` `rb_reg_match_p` | `activerecord/lib/connection-adapters/abstract/schema-definitions.ts`, `actionpack/lib/action-dispatch/http/request.ts` |
68
+ | `rbRegSUnion` | `re.c:4192` `rb_reg_s_union` | `activerecord/lib/connection-adapters/abstract-adapter.ts` (`buildReadQueryRegexp`), `sqlite3-adapter.ts` (`tableStructureSql`) |
69
+ | `Pathname` | `ext/pathname/pathname.c:1511` `rb_cPathname` | `activesupport/lib/message-pack/extensions.ts` (`Extensions.install`, ext type 15) |
70
+ | `rbRegInitStr`, `rbRegToS(re, "onig")` | `re.c:3360` `rb_reg_init_str`, `re.c:322` `option_to_str` | `activesupport/lib/message-pack/extensions.ts` (`Extensions.install`, ext type 16) |
71
+ | `Range` | `range.c:31` `rb_cRange` | `activesupport/lib/core-ext/range/*.ts`, `activemodel/lib/validations/{clusivity,length,numericality}.ts` |
72
+ | `rbEqual` | `object.c:147` `rb_equal` | `ruby-compat/lib/range.ts` (`Range#==`) |
73
+ | `succ` | `string.c:4868` `rb_str_succ` | `ruby-compat/lib/range.ts` (string ranges), `arel` |
74
+ | `Rational` | `rational.c:481` `nurat_s_canonicalize_internal` | `activemodel/lib/type/{decimal,date-time}.ts`, `type/helpers/time-value.ts`, `activesupport/lib/{time-with-zone.ts,core-ext/date-time/calculations.ts,message-pack/extensions.ts}`, `activerecord/lib/connection-adapters/mysql/quoting.ts`, `date/lib/date.ts` |
75
+ | `rational` | `rational.c:2691` `nurat_s_convert` | `activesupport/lib/core-ext/date-time/calculations.ts:274,290,306` (`end_of_day` / `end_of_hour` / `end_of_minute`), `message-pack/extensions.ts` (`read_rational`) |
76
+ | `ZeroDivisionError` | `numeric.c:206` `rb_num_zerodiv` | `activesupport/lib/message-pack/extensions.ts` (`readRational` raises it on a zero denominator) |
77
+ | `Enumerator` | `enumerator.c:411` `enumerator_init` | `activesupport/lib/hash-with-indifferent-access.ts` (`select` / `reject` block-less arm) |
78
+ | `toEnum` | `enumerator.c:383` `obj_to_enum` | `activesupport/lib/hash-with-indifferent-access.ts` (`to_enum(:select)`, `to_enum(:reject)`) |
79
+ | `Lazy` | `enumerator.c:1804` `lazy_initialize` | `rake/lib/file-list.ts` (`lazy` / `chain`, `file_list.rb:44`) |
80
+ | `Chain` | `enumerator.c:3176` `enum_chain_initialize` | `rake/lib/file-list.ts` (`lazy` / `chain`, `file_list.rb:44`) |
81
+ | `enumerableLazy` | `enumerator.c:1937` `enumerable_lazy` | `rake/lib/file-list.ts` (`lazy` / `chain`, `file_list.rb:44`) |
82
+ | `enumChain` | `enumerator.c:3371` `enum_chain` | `rake/lib/file-list.ts` (`lazy` / `chain`, `file_list.rb:44`) |
83
+ | `isSymbol` | `symbol.c:954` `rb_sym2str` | `i18n/lib/backend/{base,fallbacks,simple,key-value}.ts`, `activemodel/lib/validations/numericality.ts` |
84
+ | `symbolToS` | `symbol.c:954` `rb_sym2str` | `i18n/lib/backend/base.ts:242,444` |
85
+ | `toSym` | `symbol.c:862` `rb_str_intern` | `activerecord/lib/associations/preloader/branch.ts` (`Branch#initialize`'s `association.to_sym`, `rescue NoMethodError`) |
86
+ | `Location` | `vm_backtrace.c:1345` `rb_cBacktraceLocation` | `actionpack/lib/action-dispatch/middleware/exception-wrapper.ts` (`build_backtrace`'s `loc.label`, `SourceMapLocation#spot`) |
87
+ | `excBacktraceLocations` | `error.c:1789` `exc_backtrace_locations` | `actionview/lib/template/error.ts` (`Template::Error#backtrace_locations`), `exception-wrapper.ts` (`build_backtrace`) |
88
+ | `StringScanner` | `ext/strscan/strscan.c:681` `strscan_scan` | `actionpack/lib/action-dispatch/journey/gtg/simulator.ts` (`Simulator#memos`) |
89
+ | `rbObjInstanceVariables` | `variable.c:2259` `rb_obj_instance_variables` | `ruby-compat/lib/psych/visitors/yaml-tree.ts` (`YAMLTree#dump_ivars`) |
90
+ | `rbObjIvarGet` | `object.c:2880` `rb_obj_ivar_get` | `ruby-compat/lib/psych/visitors/yaml-tree.ts` (`YAMLTree#dump_ivars`) |
91
+ | `rbObjIvarSet` | `object.c:2914` `rb_obj_ivar_set_m` | `ruby-compat/lib/psych/visitors/to-ruby.ts` (`ToRuby#init_with`) |
92
+ | `rbDeclareIvar` | none: the ivar's JS field | `activemodel/lib/{attribute-set,attribute-set/builder,type/integer}.ts` |
93
+ | `Struct` | `struct.c:643` `rb_struct_s_def` | `arel/lib/attributes/attribute.ts` (`Attribute < Struct.new :relation, :name`) |
94
+ | `stringSuperclass` | `string.c:12119` `rb_cString` | `arel/lib/nodes/sql-literal.ts` (`SqlLiteral < String`) |
95
+ | `rbObjClass` | `object.c:265` `rb_obj_class` | `arel/lib/visitors/visitor.ts` (`visit`'s `dispatch[object.class]` and `object.class.ancestors`, `visitor.rb:28,40`) |
96
+ | `rbProcCall` | `proc.c:990` `rb_proc_call` | `actioncable/lib/connection/base.ts` (`new_tagged_logger`'s `tag.call(request)`, `connection/base.rb:262-266`) |
97
+ | `rbModName` | `variable.c:122` `rb_mod_name` | `arel/lib/visitors/visitor.ts` (`dispatch_cache`'s `klass.name`), `arel/lib/nodes/bound-sql-literal.ts` (`inspect`), `ruby-compat/lib/psych/visitors/yaml-tree.ts` (`YAMLTree#visit_Object`'s `o.class.name`), `activesupport/lib/delegation.ts` (`delegate`'s `to.name`), `activesupport/lib/core-ext/name-error.ts` (`real_mod_name`) |
98
+ | `rbSetClassPathString` | `variable.c:407` `rb_set_class_path_string` | `arel/lib/nodes/*.ts`, `arel/lib/{table,select-manager,attributes/attribute}.ts`, `arel/lib/visitors/*.ts`, `activemodel/lib/attribute.ts` |
99
+ | `rbGvGet` / `rbGvSet` | `variable.c:984` `rb_gv_get`, `:970` `rb_gv_set` | `thor/src/thor.ts` (`$thor_runner \|\|= false`), `thor/base.ts` (`handle_no_command_error`'s default) |
100
+ | `isRegisteredConstant` | `variable.c:3527` `rb_const_defined` on `rb_cObject` | `activesupport/lib/inflector.ts` (`constantize`), `trailties/lib/generators/base.ts` (`class_collisions`, `module_namespacing`) |
101
+ | `registeredConstant` | `variable.c:3210` `rb_const_get` on `rb_cObject` | `activesupport/lib/inflector.ts` (`constantize`'s `Object.const_get`) |
102
+ | `resetConstants` | none: empties the table between tests | `globalid/src/*.test.ts`, `activesupport/test/{inflector,core-ext/string-ext}.test.ts` |
103
+ | `Psych.dump` (`./psych`) | `ext/psych/lib/psych.rb:505` `Psych.dump` | `activerecord/test/cases/yaml-serialization.test.ts`, `store.test.ts` (`YAML.dump`); `ruby-compat/lib/psych/core-ext.ts` (`toYaml`) |
104
+ | `Psych.unsafeLoad` (`./psych`) | `ext/psych/lib/psych.rb:271` `Psych.unsafe_load` | `activerecord/test/cases/yaml-serialization.test.ts` (`YAML.unsafe_load`) |
105
+ | `Psych.safeDump` (`./psych`) | `ext/psych/lib/psych.rb:578` `safe_dump` | `activerecord/lib/coders/yaml-column.ts` (`yaml_column.rb:19-23`) |
106
+ | `Psych.Visitors.RestrictedYAMLTree` (`./psych`) | `psych/visitors/yaml_tree.rb:540` | `Psych.safeDump` (`psych.rb:584`) |
107
+ | `toYaml` (`./yaml`) | `ext/psych/lib/psych/core_ext.rb:12` `to_yaml` | `activerecord/lib/relation.ts` (`relations_test.rb:79-82`) |
108
+ | `Psych.loadFile` / `Psych.unsafeLoadFile` (`./psych`) | `ext/psych/lib/psych.rb:647,669` | no non-test caller until `configuration_file.rb:26`, i18n `backend/base.rb:264` and `change_generator.rb:124` converge |
109
+ | `Psych.Omap` (`./psych`) | `ext/psych/lib/psych/omap.rb:3` | `psych/visitors/to-ruby.ts` (`to_ruby.rb:149,292`), `yaml-tree.ts` (`yaml_tree.rb:139`) |
110
+ | `Psych.load` / `Psych.safeLoad` (`./psych`) | `ext/psych/lib/psych.rb:322,368` `safe_load` / `load` | `activerecord/lib/coders/yaml-column.ts` (`yaml_column.rb:37-41`), `activesupport/lib/xml-mini.ts` (`xml_mini.rb:83`), until each converges onto `Psych` |
111
+ | `Psych.loadTags` / `Psych.dumpTags` (`./psych`) | `ext/psych/lib/psych.rb:741-742` `load_tags` / `dump_tags` | `activerecord/lib/active-record.ts` (`YAML.load_tags[...]`, `active_record.rb:570-573`) |
112
+ | `Psych.domainTypes` / `Psych.addBuiltinType` (`./psych`) | `ext/psych/lib/psych.rb:682-686,738` `domain_types` / `add_builtin_type` | `ruby-compat/lib/psych/visitors/to-ruby.ts` (`ToRuby#accept`, `to_ruby.rb:35-50`) |
113
+ | `Psych.DisallowedClass` (`./psych`) | `ext/psych/lib/psych/exception.rb:23` | `activerecord/lib/coders/yaml-column.ts` (`SafeCoder#dump`) |
114
+ | `Psych.Coder` (`./psych`) | `ext/psych/lib/psych/coder.rb:9` | `activerecord/lib/legacy-yaml-adapter.ts` (`LegacyYamlAdapter.convert`), `activemodel/lib/attribute.ts` (`init_with` / `encode_with`) |
115
+ | `Psych.ClassLoader` / `.Restricted` (`./psych`) | `ext/psych/lib/psych/class_loader.rb:6,76` | `ruby-compat/lib/psych/visitors/to-ruby.ts` (`ToRuby.create`), `yaml-tree.ts` (`YAMLTree.create`); `Restricted` has no non-test caller until `psych-load-and-safe-load` |
116
+ | `Psych.ScalarScanner` (`./psych`) | `ext/psych/lib/psych/scalar_scanner.rb:7` | `ruby-compat/lib/psych/visitors/to-ruby.ts` (`ToRuby.create`), `yaml-tree.ts` (`YAMLTree.create`) |
117
+ | `Psych.Visitors.NoAliasRuby` (`./psych`) | `ext/psych/lib/psych/visitors/to_ruby.rb:430` | no non-test caller until `psych-load-and-safe-load` (`Psych.safe_load`, `psych.rb:332`) |
118
+ | `Psych.BadAlias` / `AliasesNotEnabled` / `AnchorNotDefined` (`./psych`) | `ext/psych/lib/psych/exception.rb:6-21` | `ruby-compat/lib/psych/visitors/to-ruby.ts` (`visit_Psych_Nodes_Alias`, `to_ruby.rb:327-328,431-433`) |
119
+ | `YAML` (`./yaml`) | `lib/yaml.rb:20` `YAML = Psych` | `activerecord/lib/active-record.ts` (`active_record.rb:570-573`) |
120
+ | `parse` / `stringify` (`./psych-adapter`) | `ext/psych/lib/psych.rb:13` `require 'psych.so'` (the libyaml seam) | `activerecord/lib/coders/yaml-column.ts`, `connection-adapters/schema-cache.ts`, `abstract/database-statements.ts`, `actionview/lib/helpers/debug-helper.ts`, `activesupport/lib/{configuration-file,encrypted-configuration,xml-mini}.ts`, until each converges onto `Psych` |
121
+ | `registerPsychAdapter` / `psychAdapterConfig` (`./psych-adapter`) | `ext/psych/lib/psych.rb:13` `require 'psych.so'` (the libyaml seam) | `website/src/lib/frontiers/{runtime,sandbox-sw}.ts` |
122
+ | `rbDefineMethod` | `class.c:2134` `rb_define_method` | `activesupport/lib/core-ext/object/blank.ts` (`String#blank?`, `blank.rb:153`) |
123
+ | `rbModDefineMethod` | `proc.c:2325` `rb_mod_define_method` | `activerecord/lib/autosave-association.ts` (`define_non_cyclic_method`, `autosave_association.rb:162`), `integration.ts` (`to_param`, `integration.rb:151`), `enum.ts` (`_enum`'s `singleton_class.define_method(name.pluralize)`, `enum.rb:232`), `secure-token.ts` (`has_secure_token`, `secure_token.rb:53`), `scoping/named.ts` (`scope`, `scoping/named.rb:174,180`) |
124
+ | `first` | `array.c:1901` `ary_first`, `enum.c:1284` `enum_first` | `activerecord/lib/connection-adapters/abstract-mysql-adapter.ts` (`build_insert_sql`'s `insert.keys.first` over a `Set`, `abstract_mysql_adapter.rb:640`) |
125
+ | `aryCount` | `array.c:6275` `rb_ary_count` | `activerecord/lib/associations/has-many-through-association.ts` (`delete_records`'s `scope.destroy_all.count(&:destroyed?)`) |
126
+ | `aryJoin` | `array.c:2806` `rb_ary_join` | `activerecord/lib/connection-adapters/postgresql/database-statements.ts` and `mysql/database-statements.ts` (`build_explain_clause`'s `options.join(", ").upcase` over Symbols, `postgresql/database_statements.rb:148`) |
127
+ | `Method#owner` | `proc.c:1988` `method_owner` | `activerecord/lib/scoping/default.ts` (`build_default_scope`'s `method(:default_scope).owner`, `scoping/default.rb:149`) |
128
+ | `AsyncEnumerable` | `enum.c:5047` `Init_Enumerable` (`enum_sum` `:4753`, `enum_to_a` `:711`) | `activerecord/lib/relation/batches/batch-enumerator.ts` (`include Enumerable`, `batch_enumerator.rb:6`, over an awaiting `each`) |
129
+ | `Enumerable.sum` | `enum.c:4753` `enum_sum` | `activesupport/lib/enumerable-utils.ts` (`sum`) |
130
+ | `reduce` | `enum.c:1005` `enum_inject` (`reduce`, `:5085`) | `activerecord/lib/associations/preloader/through-association.ts` (`source_records_by_owner` / `through_records_by_owner`'s `.reduce(:merge)`, `through_association.rb:89,93`) |
131
+ | `Hash#merge` | `hash.c:4144` `rb_hash_merge` | `ruby-compat/lib/enumerable.ts` (`reduce`'s `:merge` send to the preloader's `records_by_owner` Hashes) |
132
+ | `aryReject` | `array.c:4301` `rb_ary_reject` | `activerecord/lib/validations/associated.ts` (`validate_each`'s `Array(value).reject { ... }`, whose block awaits `valid?`) |
133
+ | `deleteAt` | `array.c:4072` `rb_ary_delete_at_m` | `actionpack/lib/action-controller/metal/params-wrapper.ts` (`Options#_default_wrap_model`'s `namespaces.delete_at(-2)`) |
134
+ | `rbStrGetbyte` | `string.c:6141` `rb_str_getbyte` | `actionpack/lib/action-controller/metal/request-forgery-protection.ts` (`xor_byte_strings`'s `s2.setbyte(i, s1.getbyte(i) ^ s2.getbyte(i))`) |
135
+ | `rbStrSetbyte` | `string.c:6166` `rb_str_setbyte` | `actionpack/lib/action-controller/metal/request-forgery-protection.ts` (`xor_byte_strings`'s `s2.setbyte(i, s1.getbyte(i) ^ s2.getbyte(i))`) |
136
+ | `intXor` | `numeric.c:5055` `int_xor` | `actionpack/lib/action-controller/metal/request-forgery-protection.ts` (`xor_byte_strings`'s `s1.getbyte(i) ^ s2.getbyte(i)`) |
137
+ | `aryIncludes` | `array.c:5222` `rb_ary_includes` | `activemodel/lib/validations/acceptance.ts` (`setup!`'s `klass.included_modules.include?(define_attributes)`, `acceptance.rb:20`) |
138
+ | `isNil` | `object.c:4425` `rb_true`, `object.c:4371` `rb_false` | `arel/lib/nodes/bind-param.ts` (`BindParam#nil?`'s `value.nil?`, `bind_param.rb:23`); `arel/lib/nodes/casted.ts` (`Casted#nil?` / `Quoted#nil?`, `casted.rb:15,41`); `arel/lib/visitors/to-sql.ts` (`right.nil?` in `visit_Arel_Nodes_Equality` / `NotEqual` / `IsNotDistinctFrom` / `IsDistinctFrom`, `to_sql.rb:642-690`); `arel/lib/predications.ts` (`open_ended?`'s `value.nil?`, `predications.rb:257`) |
139
+ | `partition` | `enum.c:1102` `enum_partition` | `activerecord/lib/associations/join-dependency.ts` (`walk`'s `.partition(&:first)`) |
140
+ | `groupBy` | `enum.c:1157` `enum_group_by` | `activemodel/lib/errors.ts` (`group_by_attribute`'s `@errors.group_by(&:attribute)`, `errors.rb:289-291`) |
141
+ | `each` | `array.c:2532` `rb_ary_each` | `activemodel/lib/attribute-set/builder.ts` (`LazyAttributeHash#each_key`'s `keys.each(&block)`, `attribute_set/builder.rb:131`) |
142
+ | `keys` | `hash.c:3584` `rb_hash_keys` | `activemodel/lib/attribute-set/builder.ts` (`LazyAttributeSet#keys`' `values.keys \| types.keys \| @attributes.keys`, `attribute_set/builder.rb:37`) |
143
+ | `last` | `array.c:1914` `rb_ary_last` | `activerecord/lib/relation/finder-methods.ts` (`find_last`'s `limit ? records.last(limit) : records.last`, `finder_methods.rb:634-636`) |
144
+ | `toH` | `array.c:2988` `rb_ary_to_h` | `activerecord/lib/connection-adapters/mysql/schema-statements.ts` (`indexes`' `index[-1].to_h { \|name\| … }`, `mysql/schema_statements.rb:58`) |
145
+ | `rbStrPartition` | `string.c:10574` `rb_str_partition` | `activerecord/lib/connection-adapters/sqlite3-adapter.ts` (`table_structure_sql`'s `result.partition(UNQUOTED_OPEN_PARENS_REGEX).last`, `sqlite3_adapter.rb:781-782`) |
146
+ | `Hash#replace` | `hash.c:2967` `rb_hash_replace` | `thor/src/core-ext/hash-with-indifferent-access.ts` (`replace`'s `super`, `hash_with_indifferent_access.rb:73`) |
147
+ | `slice` (Hash receiver) | `hash.c:2651` `rb_hash_slice` | `thor/src/core-ext/hash-with-indifferent-access.ts` (`slice`'s `super`, `hash_with_indifferent_access.rb:42`) |
148
+ | `update` / `mergeBang` (Hash receiver) | `hash.c:4028` `rb_hash_update` | `thor/src/core-ext/hash-with-indifferent-access.ts` (`to_hash`'s `Hash.new(default).merge!(self)`, `hash_with_indifferent_access.rb:78`) |
149
+ | `fetch` (forwarded arguments) | `hash.c:2176` `rb_hash_fetch_m` | `thor/src/core-ext/hash-with-indifferent-access.ts` (`fetch`'s `super(convert_key(key), *args)`, `hash_with_indifferent_access.rb:38`) |
150
+ | `dup` (Hash subclass) | `hash.c:1584` `rb_hash_dup` | `thor/src/core-ext/hash-with-indifferent-access.ts` (`except`'s `dup.tap`, `merge`'s `dup.merge!`, `hash_with_indifferent_access.rb:32,54`) |
151
+ | `objRespondToMissing` | `vm_method.c:3009` `obj_respond_to_missing` | `actionpack/lib/action-dispatch/routing/routes-proxy.ts` (`respond_to_missing?`'s `super`, `routes_proxy.rb:27`); `actionpack/lib/action-dispatch/http/mime-type.ts` (`Mime::Type#respond_to_missing?`'s `super`, `mime_type.rb:345`) |
152
+ | `Concurrent` (`Concurrent::Map`) | `hash.c:1782` `rb_hash_initialize` | `activemodel/lib/attribute-methods.ts` (`attribute_method_patterns_cache`'s `Concurrent::Map.new(initial_capacity: 4)` and `compute_if_absent`, `attribute_methods.rb:417-424`) |
153
+ | `Concurrent::AtomicBoolean` | `thread_sync.c:697` `rb_mutex_synchronize_m` | `activerecord/lib/asynchronous-queries-tracker.ts` (`Session#initialize`, `active?`, `finalize`, `asynchronous_queries_tracker.rb:8-28`) |
154
+ | `Concurrent::ReadWriteLock` | `thread_sync.c:1581` `rb_condvar_wait` | `activerecord/lib/asynchronous-queries-tracker.ts` (`Session#initialize`, `synchronize`, `finalize`, `asynchronous_queries_tracker.rb:8-28`) |
155
+ | `Concurrent::AtomicFixnum` | `thread_sync.c:697` `rb_mutex_synchronize_m` | `actioncable` (`Channel::Base`'s deferred-confirmation counter, `channel/base.rb:164,240,245,249`) |
156
+ | `Concurrent::TimerTask` | `thread_sync.c:626` `rb_mutex_sleep` | `actioncable` (`StreamEventLoop#timer`, `connection/stream_event_loop.rb:20`; `PeriodicTimers#stop_periodic_timers`, `channel/periodic_timers.rb:73`) |
157
+ | `ThreadPoolExecutor` (`name:`, `:abort`, `<<`, `shuttingdown?`) | `thread.c:897` `thread_s_new` | `actioncable` (`Server::Worker`, `server/worker.rb:22-37`; `StreamEventLoop`, `connection/stream_event_loop.rb:27,70-74`) |
158
+ | `globalIoExecutor` (`Concurrent.global_io_executor`) | `thread.c:897` `thread_s_new` | `actioncable` tests (`test_helper.rb:22`, `stubs/test_server.rb:35`) |
159
+ | `BasicSocket` / `TCPSocket` | `ext/socket/basicsocket.c:746`, `ext/socket/tcpsocket.c:108` | `rack/lib/handler/node.ts` (`rack.hijack`, which `Rack::Lint#check_hijack` requires to answer an `IO`, `rack/lint.rb:591-603`) |
160
+ | `Marshal` | `marshal.c:2555` `rb_define_module("Marshal")` | `activerecord/lib/connection-adapters/schema-cache.ts` (`schema_cache.rb:233,409`) and `actionview/lib/helpers/debug-helper.ts` (`debug_helper.rb:29`); byte fixtures regenerate with `ruby packages/ruby-compat/test/marshal.fixtures.rb`; `Marshal.load` resolves a class path through `rbPathToClass`, so a loaded class is one `constSet` seated |
161
+ | `rbFSystem` | `process.c:4841` `rb_f_system` | `Thor::Actions#run` (`vendor/thor/v1.4.0/lib/thor/actions.rb:268`), ported by `port-thor-actions-run-run-ruby-script-and-thor` |
162
+ | `exec` | `process.c:3015` `rb_f_exec` | `activerecord/lib/connection-adapters/abstract-adapter.ts` (`find_cmd_and_exec`, `abstract_adapter.rb:114`) |
163
+ | `encode`, `UndefinedConversionError` | `transcode.c:2906` `str_encode`, `transcode.c:4505` | `activerecord/lib/encryption/encryptor.ts` (`force_encoding_if_needed`, `encryptor.rb:166`) |
164
+ | `rbFArray` | `object.c:3825` `rb_f_array` | `actionpack/lib/action-controller/metal/params-wrapper.ts` (`Options.from_hash`'s `Array(hash[:format])`, `params_wrapper.rb:90-92`) |
165
+ | `Open3.capture2e`, `Process.Status` | `lib/open3.rb:902`, `process.c:9169` `rb_cProcessStatus` | `Thor::Actions#run`'s `capture:` arm (`actions.rb:265-266`), same story |
166
+ | `URI::Generic#opaque` / `opaque=` / `user` / `password` / `hostname` | `lib/uri/generic.rb:277,916,568,573,668` | `activerecord/lib/database-configurations/connection-url-resolver.ts` (`ConnectionUrlResolver#initialize`, `#raw_config`) |
167
+ | `rbHashSRuby2KeywordsHashP` / `rbHashSRuby2KeywordsHash` | `hash.c:1952,1974` `rb_hash_s_ruby2_keywords_hash(_p)` | `ActiveJob::Arguments` (`serialize_argument`'s `Hash.ruby2_keywords_hash?(argument)`, `deserialize_hash`'s `Hash.ruby2_keywords_hash(result)`, `vendor/rails/v8.0.5.2/activejob/lib/active_job/arguments.rb:93,154`), no caller yet: story `port-ruby-compat-ruby2-keywords-hash-flag` (RFC 0169) lands the primitive ahead of `port-activejob-arguments`, which ports those two lines |
168
+ | `PP` (`PP.pp`, `#pp`, `#seplist`, `#objectAddressGroup`, …) | `lib/pp.rb:64,95,189,216,255` | `activerecord/lib/core.ts` (`Core#pretty_print`), `relation.ts` (`Relation#pretty_print`), `associations/collection-proxy.ts`; `PP.pp` from `core.test.ts`, `relations.test.ts`, `filter-attributes.test.ts`, `associations.test.ts` |
169
+ | `PrettyPrint` (`#text`, `#breakable`, `#group`, `#nest`, `#flush`) | `lib/prettyprint.rb:34,182,226,251` | `PP`'s superclass; `activerecord/lib/core.ts` (`pp.text` / `pp.breakable` / `pp.group` in `Core#pretty_print`) |
170
+ | `Set` (`#add`, `#delete`, `#has`, `#clear`, `#subtract`) | `lib/set.rb:243,316,393,511,529,609` | `activerecord/lib/associations/preloader/association.ts` (`LoaderRecords`' `@keys_to_load = Set.new` and `subtract`, `preloader/association.rb:64,88`) |
171
+ | `rbDefineInspectCustom` | `io.c:9023` `rb_p` (prints `rb_inspect`) | `activerecord/lib/connection-adapters/abstract/connection-pool.ts`, `abstract-adapter.ts`, `encryption/cipher/aes256-gcm.ts` |
172
+
173
+ ### Core classes are class objects; `Symbol` is seated but classifies nothing
174
+
175
+ `rbObjClass` answers `Object#class` as a class object. `NilClass`, `TrueClass`,
176
+ `FalseClass`, `Numeric`, `Integer`, `Float`, `String`, `Class`, `Proc`, `Time`,
177
+ `Date`, `DateTime` and `BasicObject` are seated in `object.ts` by
178
+ `rb_define_class`; `Hash`, `Module`, `Kernel` and `Enumerable` are the exports
179
+ of those names. `include.ts` wires their MRI included modules.
180
+
181
+ `Symbol` is seated as a constant, `rbCSymbol` (`string.c:12290`,
182
+ `rb_define_class("Symbol", rb_cObject)`), so `rbPathToClass("Symbol")` answers
183
+ it: `Psych::ClassLoader#symbolize` calls its `symbol` reader, which is
184
+ `path2class("Symbol")` (`ext/psych/lib/psych/class_loader.rb:31-43,51-56`), and
185
+ `ClassLoader::Restricted#find` raises `DisallowedClass` unless `'Symbol'` is
186
+ permitted (`:92-98`). No JS value is an instance of it. A Ruby Symbol is a bare
187
+ JS string everywhere except the call sites that keep its colon to tell it from
188
+ a String, so no reading of a value can answer "is a Symbol": a classifier keyed
189
+ on the colon would call `"::1"` and `"::Float::NAN"` Symbols. `rbObjClass`
190
+ answers `String` for every string, and a call site that discriminates uses
191
+ `isSymbol`; `rbObjIsKindOf(obj, rbCSymbol)` is that same `isSymbol` reading.
192
+
193
+ | Seat | MRI | Called by |
194
+ | ----------- | ----------------------------- | ------------------------------------------------------------------------------------------- |
195
+ | `rbCSymbol` | `string.c:12290` `rb_cSymbol` | `ruby-compat/lib/variable.ts` (the `Symbol` core seat, read by `Psych::ClassLoader#symbol`) |
196
+
197
+ ### Keyword arguments are a flagged trailing hash
198
+
199
+ Ruby marks a method `ruby2_keywords` so that the keywords it was called with
200
+ arrive as a trailing Hash in `*args`, flagged to be passed on as keywords.
201
+ `ActiveJob::Core#initialize` and `Enqueuing::ClassMethods#job_or_instantiate`
202
+ are marked that way
203
+ (`vendor/rails/v8.0.5.2/activejob/lib/active_job/core.rb:103`,
204
+ `enqueuing.rb:94`), and `Arguments` reads and restores the flag across
205
+ serialization (`arguments.rb:93-97,153-155`).
206
+
207
+ JS has no keyword arguments, so a call site cannot tell `perform_later(k: 1)`
208
+ from `perform_later({ k: 1 })`. This is the repo's kwargs idiom, a trailing
209
+ options object, applied to a `ruby2_keywords` method. The rule is: **a trailing plain-object argument
210
+ to `performLater` / `new` is the kwargs hash.** The port of a `ruby2_keywords`
211
+ method flags it with `rbHashSRuby2KeywordsHash` before storing its arguments,
212
+ which is what the VM does for the Ruby method, and everything downstream asks
213
+ `rbHashSRuby2KeywordsHashP` exactly where Rails asks
214
+ `Hash.ruby2_keywords_hash?`.
215
+
216
+ This rule is recorded here by story `port-ruby-compat-ruby2-keywords-hash-flag`
217
+ (RFC 0169, the ActiveJob port), which assigns it to this README. Its callers
218
+ are `port-activejob-core` and `port-activejob-enqueuing-and-configured-job`.
219
+
220
+ The flag is membership in a module-private `WeakSet`, as MRI's is a bit in the
221
+ hash's own header (`RHASH_PASS_AS_KEYWORDS`, `internal/hash.h:23`). It is not a
222
+ property, so `Object.keys`, a spread and `JSON.stringify` never see it, and a
223
+ copy of a flagged hash is unflagged.
224
+
225
+ ### When a Ruby Hash is a `Hash` and when it is an object
226
+
227
+ A Ruby Hash is a plain JS object. It is a `Hash` (`hash.ts`, `extends Map`)
228
+ only where the site needs one of the features below, none of which an object
229
+ can hold. The class is permanent for these and is not convergence debt. That
230
+ does not license a `new Hash()` where Rails has a string-keyed `{}`.
231
+
232
+ | feature | field | MRI anchor | a trails call site |
233
+ | ------------------------------------------ | --------------------- | ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
234
+ | the `default` seat, `Hash.new(obj)` | `#default` | `hash.c:1782` `rb_hash_initialize`, `hash.c:2068` `rb_hash_default_value` | `activerecord/lib/associations/has-many-through-association.ts:90` (`Hash.new(0)`, `has_many_through_association.rb:194`) |
235
+ | the `default_proc` seat, `Hash.new { }` | `#defaultProc` | `hash.c:2308` `rb_hash_set_default_proc` | `activerecord/lib/associations/join-dependency.ts:275` (`Hash.new { \|h, klass\| h[klass] = {} }`, `join_dependency.rb:114`) |
236
+ | key equality by `eql?` / `hash` | `#eqlKeys`, `#stHash` | `hash.c:126` `rb_any_cmp`, `hash.c:171` `any_hash`; Array keys: `array.c:5165,5205` | `activerecord/lib/connection-adapters/deduplicable.ts:27` (`registry[self]`, `deduplicable.rb:9-19`); Array keys: `actionview/lib/renderer/partial-renderer/collection-caching.ts:114` |
237
+ | a binary String key `eql?` to a 7-bit one | `#binaryKeys` | `string.c:3773` `rb_str_eql`, `string.c:3629` `rb_str_hash` | none outside `hash.ts`; pinned by `hash.trails.test.ts:204` |
238
+ | `compare_by_identity` | `#identhash` | `hash.c:4427` `rb_hash_compare_by_id` | `activerecord/lib/associations/preloader/association.ts:133` (`{}.compare_by_identity`, `preloader/association.rb:200`) |
239
+ | `FL_FREEZE` on the hash, a `FrozenError` | `#frozen` | `hash.c:105` `rb_hash_freeze`, `hash.c:1602` `rb_hash_modify_check` | `activemodel/lib/errors.ts:164,174` (`hash.freeze`, `errors.rb:271,281`) |
240
+ | the iteration level, a write during `each` | `#iterLev` | `hash.c:1345` `hash_iter_lev_inc`, `hash.c:1630` "can't add a new key into hash during iteration" | none outside `hash.ts`; every `for…of` over a `Hash` raises it, pinned by `hash.trails.test.ts:1019` |
241
+
242
+ `#binaryKeys` is not a feature of its own. It is the flag that keeps a String
243
+ lookup off the `eql?` buckets until a `Uint8Array` key has been stored, so it
244
+ belongs to the key-equality row and is listed apart only because it is a field.
245
+
246
+ A key that is a string needs none of this: a JS object already compares string
247
+ keys by value. Reach for `Hash` when the key is an object, an Array or a number
248
+ that must stay a number, or when the site sets a default, freezes the hash or
249
+ compares by identity. Otherwise write `{}`.
250
+
251
+ ### The hash helpers are for the arms JS lacks
252
+
253
+ A Hash call on a plain object is written as the JS form: `k in h` /
254
+ `Object.hasOwn(h, k)`, `h[k]`, `h[k] = v`, `delete h[k]`,
255
+ `Object.assign(h, other)`, `{ ...h, ...other }`, and
256
+ `for (const [k, v] of Object.entries(h))`. The call gates credit each form
257
+ (`NATIVE_FORM_ANALOGUES`, `scripts/api-compare/enumerable-idioms.ts`). The
258
+ helpers in `hash.ts` stay for what those forms cannot do:
259
+
260
+ | helper | MRI anchor | the arm JS has no form for |
261
+ | ---------------------- | --------------------------------- | --------------------------------------------------------------------------------------------------------- |
262
+ | `hasKey` | `hash.c:3671` `rb_hash_has_key` | dispatch to a `Map`, a `Hash` or an `isKey` member; an `undefined`-valued keyword read as absent |
263
+ | `hashAref` | `hash.c:2121` `rb_hash_aref` | a miss that answers `null`; a `Hash` default; a computed key that could name an `Object.prototype` member |
264
+ | `hashAset` | `hash.c:2941` `rb_hash_aset` | a caller-supplied `"__proto__"` key; `FrozenError`; a `Map` or `set` receiver |
265
+ | `hashDelete` | `hash.c:2441` `rb_hash_delete_m` | the removed value as the result; the miss block; `FrozenError` |
266
+ | `mergeBang` / `update` | `hash.c:4028` `rb_hash_update` | the conflict block; a `Map` on either side |
267
+ | `merge` | `hash.c:4144` `rb_hash_merge` | the conflict block; a result with no prototype, so `__proto__` is an ordinary key |
268
+ | `eachPair` | `hash.c:3149` `rb_hash_each_pair` | a `Map` or `each` receiver; the receiver as the call's result |
269
+ | `fetch` | `hash.c:2176` `rb_hash_fetch_m` | all of it: a stored `nil` beats the default, and a miss with no default raises `KeyError` |
270
+ | `deleteIf` / `keepIf` | `hash.c:2564`, `hash.c:2844` | all of it: an in-place filter with Ruby truthiness on the block result |
271
+ | `hashReplace` | `hash.c:2967` `rb_hash_replace` | all of it: clear-then-copy with a `FrozenError` |
272
+
273
+ A site that needs none of those arms uses the form, and an arm with no caller
274
+ left is deleted under rule 1.
275
+
276
+ ## The contract
277
+
278
+ Four rules govern this package. Rules 2 and 3 are mechanically enforced, rule 4
279
+ is structural, and rule 1 is enforced by review until its gate lands (see
280
+ below).
281
+
282
+ ### 1. Only what trails actually calls
283
+
284
+ No member exists here without a real call site elsewhere in this repo, and one
285
+ call site is not enough (RFC 0194). A helper earns its place with one of three
286
+ things: **two or more importing files**, **object-model state** (constant
287
+ tables, ivar seats, module records), or **an adapter seam** (RFC 0135). A
288
+ helper with one importing file and neither of the others is inlined at that
289
+ caller, reduced to the subset the caller reaches. This is
290
+ not a general-purpose Ruby runtime, and it is not a place to port a method
291
+ because its siblings are already here — `String#succ` earns its keep because
292
+ `arel` calls it; `String#squeeze` does not, until something calls it.
293
+
294
+ Today this rule is enforced by review, not by a gate: the question a reviewer
295
+ asks of a new export is "where is the call site", the answer must be a file and
296
+ a line, and it goes in the table above. Mechanical enforcement is
297
+ `ruby-compat-rule-1-call-site-gate`.
298
+
299
+ The extra-surface counter does NOT enforce it, although earlier revisions of
300
+ this README said it did. `ruby-compat` is in `GATED_PACKAGES`
301
+ (`scripts/api-compare/extra-surface-mark.ts`) with its mark committed in
302
+ `extra-surface-mark.json`, and `pnpm parity:api:extra:gate` fails on any
303
+ increase in either dimension. But the counter subtracts every member carrying a
304
+ `@noRailsEquivalent` receipt, and rule 2 requires that receipt on every export,
305
+ so a correctly receipted member — speculative or not — never reaches it.
306
+
307
+ ### Growing the package: the receipt is the protocol
308
+
309
+ For a Rails package extra surface is debt and only-shrink is the whole point.
310
+ Here it is inventory: every move story adds MRI surface. The two do not
311
+ conflict, because growth here is **mark-neutral**:
312
+
313
+ - A member that arrives with its rule 2 receipt is subtracted from `novel` AND
314
+ `total`, whether its name is novel or collides with a Rails method in some
315
+ other `.rb` and would score moved. Adding it moves neither number.
316
+ - A member that arrives WITHOUT its receipt raises `total` (and, if novel,
317
+ trips the `novel === 0` pin), and the gate turns red. The fix is the
318
+ receipt, never a bigger mark.
319
+
320
+ So there is no raise path, and none is needed: the mark stays only-shrink
321
+ (`parity:api:extra:tighten` writes it DOWN) with **no reseed**, exactly as for
322
+ every other gated package. The `total` it holds today is the residue of members
323
+ that never got their receipt, a rule 2 violation burnt down by
324
+ `receipt-ruby-compat-moved-residue`.
325
+
326
+ ### Native first: the helper families kept on purpose
327
+
328
+ Where the native JS form is identical at a call site, the helper is wrong, not
329
+ optional (RFC 0194, owner ruling 2026-10-19); `ruby-compat-native-required`
330
+ enforces it for the helpers in `eslint/ruby-compat-native-required.json`. These
331
+ families are kept on purpose, with no substitution story:
332
+
333
+ - **The object model**: `include` / `extend` / `defineModule`, `rbObjDup` /
334
+ `rbObjClone`, the singleton class, constants, and `rbFSend` /
335
+ `rbObjRespondTo` for a computed name or a `method_missing` receiver.
336
+ - **The Hash semantics JS lacks**: `fetch` where the key is computed or one
337
+ argument or a block is passed (the two-argument literal-key arm on a plain
338
+ object is `Object.hasOwn(h, "k") ? h.k : default`), `deleteIf` / `keepIf` /
339
+ `hashReplace`, and the `Hash` class for the features listed above.
340
+ - **Exceptions and Kernel**: the error classes, `excSetupMessage`, `rbFLoad`,
341
+ `block()` / `rbBlockGivenP`, and `toEnum`.
342
+ - **`rbInspect`**, for a message Ruby renders with `inspect`.
343
+ - **`rtest`, `isSymbol` and `symbolToS`**, which cost the same as native and
344
+ are the sanctioned spellings.
345
+
346
+ Any other helper survives only at a site where it dispatches (a `Map` / `Hash`
347
+ receiver, a receiver answering the call itself, a computed name) or where its
348
+ semantics observably differ.
349
+
350
+ **Enumerable is free functions.** `enumerable.ts` exports each method as a
351
+ function taking the receiver first — `partition(enum, fn)`, `groupBy(enum,
352
+ fn)`, `eachSlice(enum, n, fn)` — and dispatches on an `each` receiver, an
353
+ iterable or a `Range`. Nothing is installed on `Array.prototype`. On an Array
354
+ whose block result is a boolean, the native method is the form.
355
+
356
+ ### 2. Every export carries BOTH a `vendor/ruby` citation and a receipt
357
+
358
+ Each exported member needs two things in its JSDoc:
359
+
360
+ - a `vendor/ruby/<version>/<file>:<line>` citation naming the MRI source it mirrors, and
361
+ - a `@noRailsEquivalent PERMANENT` receipt.
362
+
363
+ Both, always. They answer different questions and neither substitutes for the
364
+ other:
365
+
366
+ - The **citation** is the fidelity anchor. It says _this behavior is Ruby's, and
367
+ here is where to check it_. Without it a Ruby primitive degrades into a
368
+ hand-rolled utility, and the next contributor has no way to tell a faithful
369
+ `succ` from an approximation of one. It is the `vendor/rails` citation every
370
+ other package writes, pointed at the other upstream.
371
+ - The **receipt** is the parity bookkeeping. `@noRailsEquivalent` is what marks
372
+ a public name that has no Ruby-_Rails_ counterpart, and every name here is one
373
+ — that is the definition of this package. `PERMANENT` is the correct
374
+ permanence: these members will never converge onto a Rails method, because
375
+ there is no Rails method to converge onto. A `CONVERGEABLE <story-id>` receipt
376
+ here is a category error, not a smaller version of the same claim.
377
+
378
+ So a citation without a receipt fails the extra-surface tooling, and a receipt
379
+ without a citation passes the tooling while losing the only record of what the
380
+ code is supposed to do. Write both.
381
+
382
+ Both are enforced by `blazetrails/ruby-compat-needs-mri-citation`
383
+ (`eslint/ruby-compat-needs-mri-citation.mjs`), which RESOLVES the citation
384
+ rather than pattern-matching it: the file has to exist under `vendor/ruby/` at
385
+ the pinned SHA and the line has to be within it. The vendor tree is fetched
386
+ rather than committed, so the rule skips where it is absent — the
387
+ `rails-comparison` CI job, which fetches it, is the enforcing run. The reverse
388
+ direction is covered too: this package is in the RFC 0121
389
+ `unbacked-internal-needs-receipt` enrollment set, because every member here is
390
+ absent from the rails-private manifest by construction.
391
+
392
+ And a primitive lives here ONCE.
393
+ `blazetrails/no-ruby-compat-reimplementation` fails a function or class declared
394
+ outside this package whose name is a ruby-compat export, or a registered alias
395
+ of one (`escapeRegExp` for `Regexp.escape`, a local `fetch(hash, key, default)`
396
+ over a `Record` for `Hash#fetch`, ...). Today's copies each hold one row in
397
+ `eslint/no-ruby-compat-reimplementation-exclude.json`, which is only-shrink: a
398
+ row is deleted by the move story that converges it, and a new row is never the
399
+ remedy for new code.
400
+
401
+ That is enforced, not merely conventional.
402
+ `eslint/no-ruby-compat-reimplementation-mark.mjs` gates the register against the
403
+ committed high-water mark in
404
+ `eslint/no-ruby-compat-reimplementation-mark.json` — the way
405
+ `extra-surface-mark.json` gates extra surface — and fails when the array holds
406
+ more rows than the mark, or is not sorted (an appended row reads correctly to
407
+ the rule, so nothing else says where it belongs). Its `tighten` path writes the
408
+ mark DOWN as the move stories delete rows; there is no reseed.
409
+
410
+ ### 3. `parity:api` never enrolls this package — permanently
411
+
412
+ `parity:api`'s package list is derived from `vendor/sources.ts` via
413
+ `apiComparePackages()` (`scripts/api-compare/config.ts`), and its population is
414
+ Rails gems. `ruby-compat` has no gem counterpart there and never will: it is a
415
+ port of Ruby, and Rails-parity comparison over it is meaningless — there is
416
+ nothing on the other side to compare against.
417
+
418
+ This is not a deferral awaiting a story, and it is not a `SKIP_GROUPS` entry
419
+ with a burndown behind it. Do not add `ruby-compat` to `vendor/sources.ts`, to
420
+ `PACKAGES`, or to `PACKAGES_OUTSIDE_MANIFEST` — the last of those subtracts a
421
+ package from the `unbacked-internal-needs-receipt` rule, and this package wants
422
+ that rule at full strength (rule 2 requires the receipt unconditionally).
423
+
424
+ What it IS in is `TS_ONLY_PACKAGES` (same file) — the packages the TypeScript
425
+ extractor walks and the Rails comparison never scores. That is the whole of the
426
+ enrollment rule 1 relies on: the TS manifest has to carry the package for the
427
+ extra-surface counter to see it, while the Rails-parity population stays a list
428
+ of gems.
429
+
430
+ ### 4. It is a leaf: no workspace dependencies
431
+
432
+ `ruby-compat` depends on nothing in this workspace, and everything may depend on
433
+ it. In particular it must never depend on `@blazetrails/activesupport` — that
434
+ edge is the exact inversion the package exists to remove, and re-adding it would
435
+ put the cycle back.
436
+
437
+ `package.json` has no `dependencies` block and no workspace dependency of any
438
+ kind. The single `optionalDependencies` entry (`yaml`) is the npm backend of a
439
+ Ruby C extension (Psych's `psych.so`), reached only through its seam,
440
+ `psych-adapter.ts`. Keep it that way; if a primitive
441
+ here appears to need a trails module, the primitive is not a Ruby primitive.
@@ -0,0 +1,15 @@
1
+ import { StandardError } from "./standard-error.js";
2
+ /**
3
+ * Ruby's core `ArgumentError` (`vendor/ruby/v3.3.11/error.c:3323` `rb_eArgError`) —
4
+ * what `Comparable`'s derived operators raise through `rb_cmperr`
5
+ * (`vendor/ruby/v3.3.11/compar.c:28`). `@blazetrails/date` re-exports it so its own
6
+ * public surface is unchanged.
7
+ *
8
+ * Extends `StandardError`, mirroring Ruby's `ArgumentError < StandardError`.
9
+ *
10
+ * @noRailsEquivalent PERMANENT — Ruby core `ArgumentError`, which Rails
11
+ * inherits rather than defines.
12
+ */
13
+ export declare class ArgumentError extends StandardError {
14
+ }
15
+ //# sourceMappingURL=argument-error.d.ts.map
@@ -0,0 +1,15 @@
1
+ import { StandardError } from "./standard-error.js";
2
+ /**
3
+ * Ruby's core `ArgumentError` (`vendor/ruby/v3.3.11/error.c:3323` `rb_eArgError`) —
4
+ * what `Comparable`'s derived operators raise through `rb_cmperr`
5
+ * (`vendor/ruby/v3.3.11/compar.c:28`). `@blazetrails/date` re-exports it so its own
6
+ * public surface is unchanged.
7
+ *
8
+ * Extends `StandardError`, mirroring Ruby's `ArgumentError < StandardError`.
9
+ *
10
+ * @noRailsEquivalent PERMANENT — Ruby core `ArgumentError`, which Rails
11
+ * inherits rather than defines.
12
+ */
13
+ export class ArgumentError extends StandardError {
14
+ }
15
+ //# sourceMappingURL=argument-error.js.map