@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.
- package/LICENSE +21 -0
- package/NOTICE +6 -0
- package/README.md +440 -2
- package/dist/argument-error.d.ts +15 -0
- package/dist/argument-error.js +15 -0
- package/dist/argument-error.js.map +1 -0
- package/dist/array.d.ts +415 -0
- package/dist/array.js +1330 -0
- package/dist/array.js.map +1 -0
- package/dist/async-context-adapter.d.ts +19 -0
- package/dist/async-context-adapter.js +139 -0
- package/dist/async-context-adapter.js.map +1 -0
- package/dist/backtrace-location.d.ts +78 -0
- package/dist/backtrace-location.js +158 -0
- package/dist/backtrace-location.js.map +1 -0
- package/dist/base64.d.ts +73 -0
- package/dist/base64.js +164 -0
- package/dist/base64.js.map +1 -0
- package/dist/benchmark.d.ts +19 -0
- package/dist/benchmark.js +16 -0
- package/dist/benchmark.js.map +1 -0
- package/dist/big-decimal.d.ts +111 -0
- package/dist/big-decimal.js +584 -0
- package/dist/big-decimal.js.map +1 -0
- package/dist/bundler.d.ts +44 -0
- package/dist/bundler.js +97 -0
- package/dist/bundler.js.map +1 -0
- package/dist/cgi.d.ts +89 -0
- package/dist/cgi.js +168 -0
- package/dist/cgi.js.map +1 -0
- package/dist/child-process-adapter.d.ts +110 -0
- package/dist/child-process-adapter.js +272 -0
- package/dist/child-process-adapter.js.map +1 -0
- package/dist/class-module.d.ts +10 -0
- package/dist/class-module.js +10 -0
- package/dist/class-module.js.map +1 -0
- package/dist/classpath.d.ts +93 -0
- package/dist/classpath.js +210 -0
- package/dist/classpath.js.map +1 -0
- package/dist/closed-queue-error.d.ts +10 -0
- package/dist/closed-queue-error.js +10 -0
- package/dist/closed-queue-error.js.map +1 -0
- package/dist/comparable.d.ts +127 -0
- package/dist/comparable.js +376 -0
- package/dist/comparable.js.map +1 -0
- package/dist/complex.d.ts +49 -0
- package/dist/complex.js +164 -0
- package/dist/complex.js.map +1 -0
- package/dist/concurrent/atomic-boolean.d.ts +24 -0
- package/dist/concurrent/atomic-boolean.js +43 -0
- package/dist/concurrent/atomic-boolean.js.map +1 -0
- package/dist/concurrent/atomic-fixnum.d.ts +21 -0
- package/dist/concurrent/atomic-fixnum.js +35 -0
- package/dist/concurrent/atomic-fixnum.js.map +1 -0
- package/dist/concurrent/count-down-latch.d.ts +20 -0
- package/dist/concurrent/count-down-latch.js +50 -0
- package/dist/concurrent/count-down-latch.js.map +1 -0
- package/dist/concurrent/cyclic-barrier.d.ts +18 -0
- package/dist/concurrent/cyclic-barrier.js +50 -0
- package/dist/concurrent/cyclic-barrier.js.map +1 -0
- package/dist/concurrent/event.d.ts +19 -0
- package/dist/concurrent/event.js +31 -0
- package/dist/concurrent/event.js.map +1 -0
- package/dist/concurrent/map.d.ts +149 -0
- package/dist/concurrent/map.js +202 -0
- package/dist/concurrent/map.js.map +1 -0
- package/dist/concurrent/read-write-lock.d.ts +25 -0
- package/dist/concurrent/read-write-lock.js +70 -0
- package/dist/concurrent/read-write-lock.js.map +1 -0
- package/dist/concurrent/semaphore.d.ts +24 -0
- package/dist/concurrent/semaphore.js +74 -0
- package/dist/concurrent/semaphore.js.map +1 -0
- package/dist/concurrent/timer-task.d.ts +52 -0
- package/dist/concurrent/timer-task.js +112 -0
- package/dist/concurrent/timer-task.js.map +1 -0
- package/dist/constants.generated.d.ts +2 -0
- package/dist/constants.generated.js +64 -0
- package/dist/constants.generated.js.map +1 -0
- package/dist/converter-not-found-error.d.ts +14 -0
- package/dist/converter-not-found-error.js +14 -0
- package/dist/converter-not-found-error.js.map +1 -0
- package/dist/crypto-adapter.d.ts +64 -0
- package/dist/crypto-adapter.js +365 -0
- package/dist/crypto-adapter.js.map +1 -0
- package/dist/delegate.d.ts +156 -0
- package/dist/delegate.js +306 -0
- package/dist/delegate.js.map +1 -0
- package/dist/digest.d.ts +99 -0
- package/dist/digest.js +131 -0
- package/dist/digest.js.map +1 -0
- package/dist/dir.d.ts +225 -0
- package/dist/dir.js +608 -0
- package/dist/dir.js.map +1 -0
- package/dist/encoding-error.d.ts +14 -0
- package/dist/encoding-error.js +17 -0
- package/dist/encoding-error.js.map +1 -0
- package/dist/encoding.d.ts +121 -0
- package/dist/encoding.js +306 -0
- package/dist/encoding.js.map +1 -0
- package/dist/ensure.d.ts +15 -0
- package/dist/ensure.js +35 -0
- package/dist/ensure.js.map +1 -0
- package/dist/enumerable.d.ts +375 -0
- package/dist/enumerable.js +1102 -0
- package/dist/enumerable.js.map +1 -0
- package/dist/enumerator.d.ts +324 -0
- package/dist/enumerator.js +625 -0
- package/dist/enumerator.js.map +1 -0
- package/dist/eof-error.d.ts +14 -0
- package/dist/eof-error.js +14 -0
- package/dist/eof-error.js.map +1 -0
- package/dist/errno.d.ts +447 -0
- package/dist/errno.js +616 -0
- package/dist/errno.js.map +1 -0
- package/dist/exc-detailed-message.d.ts +15 -0
- package/dist/exc-detailed-message.js +106 -0
- package/dist/exc-detailed-message.js.map +1 -0
- package/dist/exc-to-s.d.ts +10 -0
- package/dist/exc-to-s.js +21 -0
- package/dist/exc-to-s.js.map +1 -0
- package/dist/exception.d.ts +44 -0
- package/dist/exception.js +115 -0
- package/dist/exception.js.map +1 -0
- package/dist/fiber-error.d.ts +12 -0
- package/dist/fiber-error.js +12 -0
- package/dist/fiber-error.js.map +1 -0
- package/dist/fiber.d.ts +51 -0
- package/dist/fiber.js +178 -0
- package/dist/fiber.js.map +1 -0
- package/dist/file-utils.d.ts +480 -0
- package/dist/file-utils.js +1824 -0
- package/dist/file-utils.js.map +1 -0
- package/dist/file.d.ts +643 -0
- package/dist/file.js +1334 -0
- package/dist/file.js.map +1 -0
- package/dist/float-domain-error.d.ts +17 -0
- package/dist/float-domain-error.js +17 -0
- package/dist/float-domain-error.js.map +1 -0
- package/dist/fork-children.d.ts +23 -0
- package/dist/fork-children.js +32 -0
- package/dist/fork-children.js.map +1 -0
- package/dist/frozen-error.d.ts +33 -0
- package/dist/frozen-error.js +41 -0
- package/dist/frozen-error.js.map +1 -0
- package/dist/fs-adapter.d.ts +158 -0
- package/dist/fs-adapter.js +253 -0
- package/dist/fs-adapter.js.map +1 -0
- package/dist/gem/deprecate.d.ts +10 -0
- package/dist/gem/deprecate.js +8 -0
- package/dist/gem/deprecate.js.map +1 -0
- package/dist/gem/requirement.d.ts +55 -0
- package/dist/gem/requirement.js +91 -0
- package/dist/gem/requirement.js.map +1 -0
- package/dist/gem/version.d.ts +50 -0
- package/dist/gem/version.js +148 -0
- package/dist/gem/version.js.map +1 -0
- package/dist/gem.d.ts +59 -0
- package/dist/gem.js +82 -0
- package/dist/gem.js.map +1 -0
- package/dist/hash.d.ts +967 -0
- package/dist/hash.js +1572 -0
- package/dist/hash.js.map +1 -0
- package/dist/http-adapter.d.ts +124 -0
- package/dist/http-adapter.js +220 -0
- package/dist/http-adapter.js.map +1 -0
- package/dist/immediate-executor.d.ts +20 -0
- package/dist/immediate-executor.js +39 -0
- package/dist/immediate-executor.js.map +1 -0
- package/dist/include.d.ts +778 -0
- package/dist/include.js +2208 -0
- package/dist/include.js.map +1 -0
- package/dist/index-error.d.ts +13 -0
- package/dist/index-error.js +13 -0
- package/dist/index-error.js.map +1 -0
- package/dist/index.d.ts +174 -0
- package/dist/index.js +166 -0
- package/dist/index.js.map +1 -0
- package/dist/invalid-byte-sequence-error.d.ts +62 -0
- package/dist/invalid-byte-sequence-error.js +75 -0
- package/dist/invalid-byte-sequence-error.js.map +1 -0
- package/dist/io-error.d.ts +14 -0
- package/dist/io-error.js +17 -0
- package/dist/io-error.js.map +1 -0
- package/dist/io.d.ts +867 -0
- package/dist/io.js +1960 -0
- package/dist/io.js.map +1 -0
- package/dist/ipaddr.d.ts +79 -0
- package/dist/ipaddr.js +405 -0
- package/dist/ipaddr.js.map +1 -0
- package/dist/json.d.ts +70 -0
- package/dist/json.js +181 -0
- package/dist/json.js.map +1 -0
- package/dist/kernel-catch.d.ts +59 -0
- package/dist/kernel-catch.js +184 -0
- package/dist/kernel-catch.js.map +1 -0
- package/dist/kernel-float.d.ts +19 -0
- package/dist/kernel-float.js +54 -0
- package/dist/kernel-float.js.map +1 -0
- package/dist/kernel-fork.d.ts +30 -0
- package/dist/kernel-fork.js +72 -0
- package/dist/kernel-fork.js.map +1 -0
- package/dist/kernel-format.d.ts +27 -0
- package/dist/kernel-format.js +901 -0
- package/dist/kernel-format.js.map +1 -0
- package/dist/kernel-hash.d.ts +7 -0
- package/dist/kernel-hash.js +33 -0
- package/dist/kernel-hash.js.map +1 -0
- package/dist/kernel-integer.d.ts +49 -0
- package/dist/kernel-integer.js +170 -0
- package/dist/kernel-integer.js.map +1 -0
- package/dist/kernel-rand.d.ts +16 -0
- package/dist/kernel-rand.js +237 -0
- package/dist/kernel-rand.js.map +1 -0
- package/dist/kernel-system.d.ts +39 -0
- package/dist/kernel-system.js +103 -0
- package/dist/kernel-system.js.map +1 -0
- package/dist/kernel-warn.d.ts +35 -0
- package/dist/kernel-warn.js +73 -0
- package/dist/kernel-warn.js.map +1 -0
- package/dist/key-error.d.ts +44 -0
- package/dist/key-error.js +59 -0
- package/dist/key-error.js.map +1 -0
- package/dist/keyword-splat.d.ts +41 -0
- package/dist/keyword-splat.js +65 -0
- package/dist/keyword-splat.js.map +1 -0
- package/dist/load-error.d.ts +19 -0
- package/dist/load-error.js +19 -0
- package/dist/load-error.js.map +1 -0
- package/dist/load.d.ts +128 -0
- package/dist/load.js +278 -0
- package/dist/load.js.map +1 -0
- package/dist/loaded-features.d.ts +13 -0
- package/dist/loaded-features.js +15 -0
- package/dist/loaded-features.js.map +1 -0
- package/dist/local-jump-error.d.ts +12 -0
- package/dist/local-jump-error.js +12 -0
- package/dist/local-jump-error.js.map +1 -0
- package/dist/logger/formatter.d.ts +21 -0
- package/dist/logger/formatter.js +43 -0
- package/dist/logger/formatter.js.map +1 -0
- package/dist/logger/log-device.d.ts +52 -0
- package/dist/logger/log-device.js +104 -0
- package/dist/logger/log-device.js.map +1 -0
- package/dist/logger/severity.d.ts +23 -0
- package/dist/logger/severity.js +42 -0
- package/dist/logger/severity.js.map +1 -0
- package/dist/logger.d.ts +127 -0
- package/dist/logger.js +218 -0
- package/dist/logger.js.map +1 -0
- package/dist/marshal.d.ts +83 -0
- package/dist/marshal.js +1487 -0
- package/dist/marshal.js.map +1 -0
- package/dist/match-data.d.ts +161 -0
- package/dist/match-data.js +284 -0
- package/dist/match-data.js.map +1 -0
- package/dist/method-cache.d.ts +81 -0
- package/dist/method-cache.js +109 -0
- package/dist/method-cache.js.map +1 -0
- package/dist/method-missing-proxy.d.ts +53 -0
- package/dist/method-missing-proxy.js +154 -0
- package/dist/method-missing-proxy.js.map +1 -0
- package/dist/method.d.ts +132 -0
- package/dist/method.js +320 -0
- package/dist/method.js.map +1 -0
- package/dist/monitor.d.ts +114 -0
- package/dist/monitor.js +270 -0
- package/dist/monitor.js.map +1 -0
- package/dist/mutex.d.ts +51 -0
- package/dist/mutex.js +150 -0
- package/dist/mutex.js.map +1 -0
- package/dist/name-error.d.ts +45 -0
- package/dist/name-error.js +54 -0
- package/dist/name-error.js.map +1 -0
- package/dist/net/http/exceptions.d.ts +31 -0
- package/dist/net/http/exceptions.js +46 -0
- package/dist/net/http/exceptions.js.map +1 -0
- package/dist/net/http/request.d.ts +137 -0
- package/dist/net/http/request.js +559 -0
- package/dist/net/http/request.js.map +1 -0
- package/dist/net/http/requests.d.ts +197 -0
- package/dist/net/http/requests.js +197 -0
- package/dist/net/http/requests.js.map +1 -0
- package/dist/net/http/response.d.ts +141 -0
- package/dist/net/http/response.js +416 -0
- package/dist/net/http/response.js.map +1 -0
- package/dist/net/http/responses.d.ts +345 -0
- package/dist/net/http/responses.js +486 -0
- package/dist/net/http/responses.js.map +1 -0
- package/dist/net/http.d.ts +278 -0
- package/dist/net/http.js +760 -0
- package/dist/net/http.js.map +1 -0
- package/dist/net/protocol.d.ts +227 -0
- package/dist/net/protocol.js +392 -0
- package/dist/net/protocol.js.map +1 -0
- package/dist/nil-class.d.ts +10 -0
- package/dist/nil-class.js +27 -0
- package/dist/nil-class.js.map +1 -0
- package/dist/no-method-error.d.ts +38 -0
- package/dist/no-method-error.js +45 -0
- package/dist/no-method-error.js.map +1 -0
- package/dist/not-implemented-error.d.ts +13 -0
- package/dist/not-implemented-error.js +13 -0
- package/dist/not-implemented-error.js.map +1 -0
- package/dist/numeric-class.d.ts +29 -0
- package/dist/numeric-class.js +41 -0
- package/dist/numeric-class.js.map +1 -0
- package/dist/numeric.d.ts +226 -0
- package/dist/numeric.js +848 -0
- package/dist/numeric.js.map +1 -0
- package/dist/object-space.d.ts +34 -0
- package/dist/object-space.js +152 -0
- package/dist/object-space.js.map +1 -0
- package/dist/object.d.ts +833 -0
- package/dist/object.js +2131 -0
- package/dist/object.js.map +1 -0
- package/dist/open-uri.d.ts +180 -0
- package/dist/open-uri.js +402 -0
- package/dist/open-uri.js.map +1 -0
- package/dist/open3.d.ts +69 -0
- package/dist/open3.js +134 -0
- package/dist/open3.js.map +1 -0
- package/dist/openssl.d.ts +479 -0
- package/dist/openssl.js +1052 -0
- package/dist/openssl.js.map +1 -0
- package/dist/optparse.d.ts +130 -0
- package/dist/optparse.js +457 -0
- package/dist/optparse.js.map +1 -0
- package/dist/os-adapter.d.ts +20 -0
- package/dist/os-adapter.js +95 -0
- package/dist/os-adapter.js.map +1 -0
- package/dist/pathname.d.ts +73 -0
- package/dist/pathname.js +412 -0
- package/dist/pathname.js.map +1 -0
- package/dist/pp.d.ts +60 -0
- package/dist/pp.js +195 -0
- package/dist/pp.js.map +1 -0
- package/dist/pretty-print.d.ts +89 -0
- package/dist/pretty-print.js +232 -0
- package/dist/pretty-print.js.map +1 -0
- package/dist/process-adapter.d.ts +229 -0
- package/dist/process-adapter.js +889 -0
- package/dist/process-adapter.js.map +1 -0
- package/dist/process.d.ts +202 -0
- package/dist/process.js +433 -0
- package/dist/process.js.map +1 -0
- package/dist/psych/class-loader.d.ts +92 -0
- package/dist/psych/class-loader.js +139 -0
- package/dist/psych/class-loader.js.map +1 -0
- package/dist/psych/coder.d.ts +144 -0
- package/dist/psych/coder.js +176 -0
- package/dist/psych/coder.js.map +1 -0
- package/dist/psych/core-ext.d.ts +8 -0
- package/dist/psych/core-ext.js +10 -0
- package/dist/psych/core-ext.js.map +1 -0
- package/dist/psych/emitter.d.ts +116 -0
- package/dist/psych/emitter.js +1130 -0
- package/dist/psych/emitter.js.map +1 -0
- package/dist/psych/exception.d.ts +43 -0
- package/dist/psych/exception.js +54 -0
- package/dist/psych/exception.js.map +1 -0
- package/dist/psych/handler.d.ts +59 -0
- package/dist/psych/handler.js +95 -0
- package/dist/psych/handler.js.map +1 -0
- package/dist/psych/handlers/document-stream.d.ts +17 -0
- package/dist/psych/handlers/document-stream.js +26 -0
- package/dist/psych/handlers/document-stream.js.map +1 -0
- package/dist/psych/nodes/alias.d.ts +15 -0
- package/dist/psych/nodes/alias.js +22 -0
- package/dist/psych/nodes/alias.js.map +1 -0
- package/dist/psych/nodes/document.d.ts +23 -0
- package/dist/psych/nodes/document.js +35 -0
- package/dist/psych/nodes/document.js.map +1 -0
- package/dist/psych/nodes/mapping.d.ts +25 -0
- package/dist/psych/nodes/mapping.js +35 -0
- package/dist/psych/nodes/mapping.js.map +1 -0
- package/dist/psych/nodes/node.d.ts +59 -0
- package/dist/psych/nodes/node.js +79 -0
- package/dist/psych/nodes/node.js.map +1 -0
- package/dist/psych/nodes/scalar.d.ts +35 -0
- package/dist/psych/nodes/scalar.js +47 -0
- package/dist/psych/nodes/scalar.js.map +1 -0
- package/dist/psych/nodes/sequence.d.ts +25 -0
- package/dist/psych/nodes/sequence.js +35 -0
- package/dist/psych/nodes/sequence.js.map +1 -0
- package/dist/psych/nodes/stream.d.ts +23 -0
- package/dist/psych/nodes/stream.js +31 -0
- package/dist/psych/nodes/stream.js.map +1 -0
- package/dist/psych/omap.d.ts +9 -0
- package/dist/psych/omap.js +9 -0
- package/dist/psych/omap.js.map +1 -0
- package/dist/psych/parser.d.ts +41 -0
- package/dist/psych/parser.js +139 -0
- package/dist/psych/parser.js.map +1 -0
- package/dist/psych/scalar-scanner.d.ts +31 -0
- package/dist/psych/scalar-scanner.js +169 -0
- package/dist/psych/scalar-scanner.js.map +1 -0
- package/dist/psych/syntax-error.d.ts +23 -0
- package/dist/psych/syntax-error.js +35 -0
- package/dist/psych/syntax-error.js.map +1 -0
- package/dist/psych/tree-builder.d.ts +51 -0
- package/dist/psych/tree-builder.js +118 -0
- package/dist/psych/tree-builder.js.map +1 -0
- package/dist/psych/visitors/depth-first.d.ts +27 -0
- package/dist/psych/visitors/depth-first.js +37 -0
- package/dist/psych/visitors/depth-first.js.map +1 -0
- package/dist/psych/visitors/emitter.d.ts +32 -0
- package/dist/psych/visitors/emitter.js +63 -0
- package/dist/psych/visitors/emitter.js.map +1 -0
- package/dist/psych/visitors/to-ruby.d.ts +110 -0
- package/dist/psych/visitors/to-ruby.js +396 -0
- package/dist/psych/visitors/to-ruby.js.map +1 -0
- package/dist/psych/visitors/visitor.d.ts +11 -0
- package/dist/psych/visitors/visitor.js +17 -0
- package/dist/psych/visitors/visitor.js.map +1 -0
- package/dist/psych/visitors/yaml-tree.d.ts +182 -0
- package/dist/psych/visitors/yaml-tree.js +593 -0
- package/dist/psych/visitors/yaml-tree.js.map +1 -0
- package/dist/psych-adapter.d.ts +65 -0
- package/dist/psych-adapter.js +121 -0
- package/dist/psych-adapter.js.map +1 -0
- package/dist/psych-yaml.d.ts +2 -0
- package/dist/psych-yaml.js +5 -0
- package/dist/psych-yaml.js.map +1 -0
- package/dist/psych.d.ts +257 -0
- package/dist/psych.js +332 -0
- package/dist/psych.js.map +1 -0
- package/dist/queue.d.ts +137 -0
- package/dist/queue.js +236 -0
- package/dist/queue.js.map +1 -0
- package/dist/racc/parser.d.ts +70 -0
- package/dist/racc/parser.js +206 -0
- package/dist/racc/parser.js.map +1 -0
- package/dist/range-error.d.ts +15 -0
- package/dist/range-error.js +15 -0
- package/dist/range-error.js.map +1 -0
- package/dist/range.d.ts +166 -0
- package/dist/range.js +421 -0
- package/dist/range.js.map +1 -0
- package/dist/rational.d.ts +168 -0
- package/dist/rational.js +587 -0
- package/dist/rational.js.map +1 -0
- package/dist/rb-config.d.ts +33 -0
- package/dist/rb-config.js +53 -0
- package/dist/rb-config.js.map +1 -0
- package/dist/rb-equal.d.ts +66 -0
- package/dist/rb-equal.js +262 -0
- package/dist/rb-equal.js.map +1 -0
- package/dist/rb-hash.d.ts +26 -0
- package/dist/rb-hash.js +108 -0
- package/dist/rb-hash.js.map +1 -0
- package/dist/regexp.d.ts +82 -0
- package/dist/regexp.js +191 -0
- package/dist/regexp.js.map +1 -0
- package/dist/repl-adapter.d.ts +270 -0
- package/dist/repl-adapter.js +562 -0
- package/dist/repl-adapter.js.map +1 -0
- package/dist/resolv.d.ts +30 -0
- package/dist/resolv.js +48 -0
- package/dist/resolv.js.map +1 -0
- package/dist/ruby-empty.d.ts +28 -0
- package/dist/ruby-empty.js +40 -0
- package/dist/ruby-empty.js.map +1 -0
- package/dist/ruby-platform.d.ts +39 -0
- package/dist/ruby-platform.js +49 -0
- package/dist/ruby-platform.js.map +1 -0
- package/dist/runtime-error.d.ts +15 -0
- package/dist/runtime-error.js +15 -0
- package/dist/runtime-error.js.map +1 -0
- package/dist/scheduled-task.d.ts +73 -0
- package/dist/scheduled-task.js +150 -0
- package/dist/scheduled-task.js.map +1 -0
- package/dist/secure-random.d.ts +50 -0
- package/dist/secure-random.js +141 -0
- package/dist/secure-random.js.map +1 -0
- package/dist/set.d.ts +158 -0
- package/dist/set.js +352 -0
- package/dist/set.js.map +1 -0
- package/dist/shellwords.d.ts +27 -0
- package/dist/shellwords.js +53 -0
- package/dist/shellwords.js.map +1 -0
- package/dist/signal-exception.d.ts +43 -0
- package/dist/signal-exception.js +88 -0
- package/dist/signal-exception.js.map +1 -0
- package/dist/socket.d.ts +230 -0
- package/dist/socket.js +484 -0
- package/dist/socket.js.map +1 -0
- package/dist/standard-error.d.ts +27 -0
- package/dist/standard-error.js +49 -0
- package/dist/standard-error.js.map +1 -0
- package/dist/stop-iteration.d.ts +10 -0
- package/dist/stop-iteration.js +10 -0
- package/dist/stop-iteration.js.map +1 -0
- package/dist/string/b.d.ts +19 -0
- package/dist/string/b.js +28 -0
- package/dist/string/b.js.map +1 -0
- package/dist/string/byte-methods.d.ts +57 -0
- package/dist/string/byte-methods.js +266 -0
- package/dist/string/byte-methods.js.map +1 -0
- package/dist/string/bytes.d.ts +35 -0
- package/dist/string/bytes.js +123 -0
- package/dist/string/bytes.js.map +1 -0
- package/dist/string/case-mapping.d.ts +57 -0
- package/dist/string/case-mapping.js +192 -0
- package/dist/string/case-mapping.js.map +1 -0
- package/dist/string/chomp.d.ts +15 -0
- package/dist/string/chomp.js +32 -0
- package/dist/string/chomp.js.map +1 -0
- package/dist/string/convert.d.ts +55 -0
- package/dist/string/convert.js +316 -0
- package/dist/string/convert.js.map +1 -0
- package/dist/string/delete.d.ts +14 -0
- package/dist/string/delete.js +17 -0
- package/dist/string/delete.js.map +1 -0
- package/dist/string/each.d.ts +108 -0
- package/dist/string/each.js +305 -0
- package/dist/string/each.js.map +1 -0
- package/dist/string/encode.d.ts +37 -0
- package/dist/string/encode.js +268 -0
- package/dist/string/encode.js.map +1 -0
- package/dist/string/force-encoding.d.ts +72 -0
- package/dist/string/force-encoding.js +147 -0
- package/dist/string/force-encoding.js.map +1 -0
- package/dist/string/inspect.d.ts +17 -0
- package/dist/string/inspect.js +81 -0
- package/dist/string/inspect.js.map +1 -0
- package/dist/string/method-table.d.ts +174 -0
- package/dist/string/method-table.js +805 -0
- package/dist/string/method-table.js.map +1 -0
- package/dist/string/scrub.d.ts +12 -0
- package/dist/string/scrub.js +33 -0
- package/dist/string/scrub.js.map +1 -0
- package/dist/string/slice.d.ts +26 -0
- package/dist/string/slice.js +73 -0
- package/dist/string/slice.js.map +1 -0
- package/dist/string/split.d.ts +11 -0
- package/dist/string/split.js +44 -0
- package/dist/string/split.js.map +1 -0
- package/dist/string/sub.d.ts +114 -0
- package/dist/string/sub.js +371 -0
- package/dist/string/sub.js.map +1 -0
- package/dist/string/succ.d.ts +14 -0
- package/dist/string/succ.js +118 -0
- package/dist/string/succ.js.map +1 -0
- package/dist/string/support.d.ts +142 -0
- package/dist/string/support.js +296 -0
- package/dist/string/support.js.map +1 -0
- package/dist/string/tr.d.ts +46 -0
- package/dist/string/tr.js +156 -0
- package/dist/string/tr.js.map +1 -0
- package/dist/string-io.d.ts +166 -0
- package/dist/string-io.js +248 -0
- package/dist/string-io.js.map +1 -0
- package/dist/string-scanner.d.ts +133 -0
- package/dist/string-scanner.js +248 -0
- package/dist/string-scanner.js.map +1 -0
- package/dist/struct.d.ts +54 -0
- package/dist/struct.js +222 -0
- package/dist/struct.js.map +1 -0
- package/dist/symbol.d.ts +48 -0
- package/dist/symbol.js +107 -0
- package/dist/symbol.js.map +1 -0
- package/dist/tempfile.d.ts +173 -0
- package/dist/tempfile.js +295 -0
- package/dist/tempfile.js.map +1 -0
- package/dist/temporal-tag.d.ts +23 -0
- package/dist/temporal-tag.js +29 -0
- package/dist/temporal-tag.js.map +1 -0
- package/dist/thread-error.d.ts +13 -0
- package/dist/thread-error.js +13 -0
- package/dist/thread-error.js.map +1 -0
- package/dist/thread-pool-executor.d.ts +121 -0
- package/dist/thread-pool-executor.js +254 -0
- package/dist/thread-pool-executor.js.map +1 -0
- package/dist/thread.d.ts +211 -0
- package/dist/thread.js +495 -0
- package/dist/thread.js.map +1 -0
- package/dist/timeout.d.ts +29 -0
- package/dist/timeout.js +41 -0
- package/dist/timeout.js.map +1 -0
- package/dist/tse.d.ts +40 -0
- package/dist/tse.js +66 -0
- package/dist/tse.js.map +1 -0
- package/dist/type-error.d.ts +14 -0
- package/dist/type-error.js +14 -0
- package/dist/type-error.js.map +1 -0
- package/dist/undefined-conversion-error.d.ts +10 -0
- package/dist/undefined-conversion-error.js +10 -0
- package/dist/undefined-conversion-error.js.map +1 -0
- package/dist/uri/common.d.ts +209 -0
- package/dist/uri/common.js +369 -0
- package/dist/uri/common.js.map +1 -0
- package/dist/uri/generic.d.ts +280 -0
- package/dist/uri/generic.js +806 -0
- package/dist/uri/generic.js.map +1 -0
- package/dist/uri/http.d.ts +23 -0
- package/dist/uri/http.js +30 -0
- package/dist/uri/http.js.map +1 -0
- package/dist/uri/https.d.ts +13 -0
- package/dist/uri/https.js +15 -0
- package/dist/uri/https.js.map +1 -0
- package/dist/uri/rfc2396-parser.d.ts +70 -0
- package/dist/uri/rfc2396-parser.js +264 -0
- package/dist/uri/rfc2396-parser.js.map +1 -0
- package/dist/uri/rfc3986-parser.d.ts +46 -0
- package/dist/uri/rfc3986-parser.js +171 -0
- package/dist/uri/rfc3986-parser.js.map +1 -0
- package/dist/uri.d.ts +13 -0
- package/dist/uri.js +13 -0
- package/dist/uri.js.map +1 -0
- package/dist/variable.d.ts +183 -0
- package/dist/variable.js +463 -0
- package/dist/variable.js.map +1 -0
- package/dist/verbose.d.ts +39 -0
- package/dist/verbose.js +49 -0
- package/dist/verbose.js.map +1 -0
- package/dist/yaml.d.ts +9 -0
- package/dist/yaml.js +9 -0
- package/dist/yaml.js.map +1 -0
- package/dist/zlib-adapter.d.ts +119 -0
- package/dist/zlib-adapter.js +230 -0
- package/dist/zlib-adapter.js.map +1 -0
- package/dist/zlib.d.ts +299 -0
- package/dist/zlib.js +679 -0
- package/dist/zlib.js.map +1 -0
- 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
|
-
#
|
|
1
|
+
# @blazetrails/ruby-compat
|
|
2
2
|
|
|
3
|
-
|
|
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
|