@blazetrails/ruby-compat 0.0.0-stage → 0.1.0-alpha0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +77 -0
- package/dist/backtrace-location.js +155 -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 +110 -0
- package/dist/big-decimal.js +582 -0
- package/dist/big-decimal.js.map +1 -0
- package/dist/bundler.d.ts +44 -0
- package/dist/bundler.js +101 -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 +90 -0
- package/dist/classpath.js +207 -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 +48 -0
- package/dist/complex.js +162 -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 +218 -0
- package/dist/dir.js +599 -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 +1100 -0
- package/dist/enumerable.js.map +1 -0
- package/dist/enumerator.d.ts +321 -0
- package/dist/enumerator.js +642 -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 +327 -0
- package/dist/errno.js +452 -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 +34 -0
- package/dist/exception.js +99 -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 +1823 -0
- package/dist/file-utils.js.map +1 -0
- package/dist/file.d.ts +635 -0
- package/dist/file.js +1312 -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 +42 -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 +64 -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 +123 -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 +2195 -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 +67 -0
- package/dist/json.js +185 -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 +40 -0
- package/dist/kernel-system.js +97 -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 +121 -0
- package/dist/load.js +263 -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 +215 -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 +17 -0
- package/dist/method-cache.js +19 -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 +14 -0
- package/dist/not-implemented-error.js.map +1 -0
- package/dist/numeric.d.ts +211 -0
- package/dist/numeric.js +802 -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 +908 -0
- package/dist/object.js +2238 -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 +71 -0
- package/dist/pathname.js +394 -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 +224 -0
- package/dist/process-adapter.js +878 -0
- package/dist/process-adapter.js.map +1 -0
- package/dist/process.d.ts +192 -0
- package/dist/process.js +403 -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 +35 -0
- package/dist/psych/scalar-scanner.js +173 -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 +129 -0
- package/dist/queue.js +215 -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 +167 -0
- package/dist/rational.js +379 -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 +261 -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 +188 -0
- package/dist/repl-adapter.js +388 -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 +16 -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 +33 -0
- package/dist/secure-random.js +78 -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 +21 -0
- package/dist/signal-exception.js +21 -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 +18 -0
- package/dist/standard-error.js +23 -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 +135 -0
- package/dist/string/support.js +283 -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 +290 -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 +119 -0
- package/dist/thread-pool-executor.js +250 -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 +62 -0
- package/dist/tse.js.map +1 -0
- package/dist/type-error.d.ts +14 -0
- package/dist/type-error.js +15 -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 +283 -0
- package/dist/uri/generic.js +810 -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 +21 -0
- package/dist/verbose.js +26 -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 +117 -0
- package/dist/zlib-adapter.js +250 -0
- package/dist/zlib-adapter.js.map +1 -0
- package/dist/zlib.d.ts +248 -0
- package/dist/zlib.js +362 -0
- package/dist/zlib.js.map +1 -0
- package/package.json +82 -3
|
@@ -0,0 +1,778 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ruby-style `include` for mixing module methods into a class.
|
|
3
|
+
*
|
|
4
|
+
* In Ruby, `include SomeModule` copies the module's instance methods
|
|
5
|
+
* onto the including class's method lookup chain. This function does
|
|
6
|
+
* the TypeScript equivalent: assigns each method from the module object
|
|
7
|
+
* onto `klass.prototype`.
|
|
8
|
+
*
|
|
9
|
+
* Mirrors: Ruby's Module#include — vendor/ruby/v3.3.11/eval.c:1139 `rb_mod_include`,
|
|
10
|
+
* backed by vendor/ruby/v3.3.11/class.c:1179 `rb_include_module`.
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* // Define a module as a plain object of this-typed functions
|
|
14
|
+
* const QueryMethods = {
|
|
15
|
+
* whereBang(this: Relation, opts: any) { ... },
|
|
16
|
+
* orderBang(this: Relation, ...args: any[]) { ... },
|
|
17
|
+
* };
|
|
18
|
+
*
|
|
19
|
+
* // Include it into a class
|
|
20
|
+
* include(Relation, QueryMethods);
|
|
21
|
+
*/
|
|
22
|
+
import { methodCacheSerial, rbClearMethodCache } from "./method-cache.js";
|
|
23
|
+
import { abort } from "./process-adapter.js";
|
|
24
|
+
import type { kernelRand, kernelSrand } from "./kernel-rand.js";
|
|
25
|
+
import type { rbFRequireFile } from "./load.js";
|
|
26
|
+
import { classModule } from "./class-module.js";
|
|
27
|
+
export { classModule };
|
|
28
|
+
import { type TopLevelConstants } from "./object.js";
|
|
29
|
+
type AnyClass = new (...args: never[]) => unknown;
|
|
30
|
+
type ModuleObject = object;
|
|
31
|
+
type AnyFunction = (...args: never) => unknown;
|
|
32
|
+
/**
|
|
33
|
+
* Mirrors: Ruby's Module#const_set — vendor/ruby/v3.3.11/object.c:2545
|
|
34
|
+
* `rb_mod_const_set`, which raises `NameError` for a name that is not a
|
|
35
|
+
* constant name (`id_for_var`, object.c:2220-2240): an uppercase or titlecase
|
|
36
|
+
* letter (`rb_sym_constant_char_p`, vendor/ruby/v3.3.11/symbol.c:218-250), then
|
|
37
|
+
* identifier characters (`is_identchar`, symbol.c:54). It then calls `const_set`
|
|
38
|
+
* (vendor/ruby/v3.3.11/variable.c:3607). Binding a module names it after the
|
|
39
|
+
* owner (variable.c:3648-3668), as it does a class or a `defineModule` plain
|
|
40
|
+
* module: permanently under a named
|
|
41
|
+
* owner, and under an anonymous one with the owner's temporary path, until a
|
|
42
|
+
* named owner re-paths it. `Module#name` and `Module#inspect` read that path.
|
|
43
|
+
* `rb_namespace_p` (variable.c:83) admits a class or a module: a class here is a function
|
|
44
|
+
* whose `prototype` is non-writable, which holds for `class` syntax and the
|
|
45
|
+
* built-in constructors and for no arrow, bound or `function` function — the
|
|
46
|
+
* test `rbInspect` applies before rendering a value through `rbModToS`.
|
|
47
|
+
* Setting a name an autoload holds deletes the autoload, as
|
|
48
|
+
* `const_tbl_update` does (vendor/ruby/v3.3.11/variable.c:3710-3724).
|
|
49
|
+
*
|
|
50
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
51
|
+
*/
|
|
52
|
+
export declare function constSet<T>(mod: Module | (abstract new (...args: never) => unknown) | {
|
|
53
|
+
readonly name: string;
|
|
54
|
+
} | ModuleObject | TopLevelConstants, id: string, value: T): T;
|
|
55
|
+
/**
|
|
56
|
+
* Mirrors: Ruby's Module#const_defined? — vendor/ruby/v3.3.11/object.c:2596
|
|
57
|
+
* `rb_mod_const_defined`, which raises `NameError` for a name that is not a
|
|
58
|
+
* constant name and otherwise answers `rb_const_defined`: the constant on the
|
|
59
|
+
* module or one of its ancestors, or on the module alone when `recur` is
|
|
60
|
+
* false. A `::` path is walked a segment at a time, each
|
|
61
|
+
* later segment read from the namespace before it alone, and the first also
|
|
62
|
+
* from the top-level table `TopLevel`.
|
|
63
|
+
*
|
|
64
|
+
* @noRailsEquivalent PERMANENT
|
|
65
|
+
*/
|
|
66
|
+
export declare function constDefined(mod: Module | (abstract new (...args: never) => unknown) | {
|
|
67
|
+
readonly name: string;
|
|
68
|
+
} | ModuleObject, name: string, recur?: boolean): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Ruby's `Module.new` — an anonymous module built at runtime and populated
|
|
71
|
+
* after the fact (`mod.module_eval { define_method … }`), then mixed into a
|
|
72
|
+
* class with `include`.
|
|
73
|
+
*
|
|
74
|
+
* Unlike a plain-object module, whose methods `include()` copies onto the
|
|
75
|
+
* class prototype once, a `Module` instance is *live*: `include()` splices a
|
|
76
|
+
* carrier object into the prototype chain directly below the including class's
|
|
77
|
+
* prototype, and every method the module defines afterwards is found by
|
|
78
|
+
* instances from then on. That is Ruby's actual include semantics — including
|
|
79
|
+
* that a method defined in the class body outranks the module's.
|
|
80
|
+
*
|
|
81
|
+
* The carrier is a separate object from the module because a JS object cannot
|
|
82
|
+
* be both: everything reachable from a link in an instance's prototype chain is
|
|
83
|
+
* an instance method, whereas Ruby's module object carries its own methods
|
|
84
|
+
* (`Module#inspect`, `#name`) outside the ancestry it contributes. So the
|
|
85
|
+
* module's methods are reached through the Ruby-named Module API below, which
|
|
86
|
+
* operates on the carrier.
|
|
87
|
+
*
|
|
88
|
+
* Mirrors: Ruby's Module.new — vendor/ruby/v3.3.11/object.c:1950 `rb_mod_initialize`.
|
|
89
|
+
*
|
|
90
|
+
* @noRailsEquivalent PERMANENT — a Ruby core class, not a Rails one.
|
|
91
|
+
*/
|
|
92
|
+
export declare class Module<I extends object = Record<never, never>> {
|
|
93
|
+
/**
|
|
94
|
+
* Mirrors: Ruby's Module.new — vendor/ruby/v3.3.11/object.c:1950
|
|
95
|
+
* `rb_mod_initialize`, which hands a given block the new module
|
|
96
|
+
* (`rb_mod_module_exec(1, &module, module)`, object.c:1959).
|
|
97
|
+
*
|
|
98
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
99
|
+
*/
|
|
100
|
+
constructor(block?: (mod: Module) => void);
|
|
101
|
+
/**
|
|
102
|
+
* Mirrors: Ruby's Module#to_s — vendor/ruby/v3.3.11/object.c:1710
|
|
103
|
+
* `rb_mod_to_s`, the method `Module#inspect` is an alias of
|
|
104
|
+
* (vendor/ruby/v3.3.11/object.c:4438-4439).
|
|
105
|
+
*
|
|
106
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
107
|
+
*/
|
|
108
|
+
toS(): string;
|
|
109
|
+
/**
|
|
110
|
+
* Mirrors: Ruby's Module#inspect — vendor/ruby/v3.3.11/object.c:1710
|
|
111
|
+
* `rb_mod_to_s`, which renders `rb_class_name`: the classpath, or the
|
|
112
|
+
* `#<Klass:0x…>` path `make_temporary_path` (vendor/ruby/v3.3.11/variable.c:320)
|
|
113
|
+
* gives an anonymous one.
|
|
114
|
+
*
|
|
115
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
116
|
+
*/
|
|
117
|
+
inspect(): string;
|
|
118
|
+
/**
|
|
119
|
+
* Mirrors: Ruby's Module#name — vendor/ruby/v3.3.11/variable.c:122
|
|
120
|
+
* `rb_mod_name`: the classpath `const_set` gave the module, or `nil` while
|
|
121
|
+
* it is anonymous.
|
|
122
|
+
*
|
|
123
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
124
|
+
*/
|
|
125
|
+
get name(): string | null;
|
|
126
|
+
/**
|
|
127
|
+
* Mirrors: Ruby's Module#module_eval — vendor/ruby/v3.3.11/vm_eval.c:2128
|
|
128
|
+
* `rb_mod_module_eval` — yields the module's method table, with the module
|
|
129
|
+
* as `this` (the block's `self`), so a block can call `this.include(...)`.
|
|
130
|
+
*
|
|
131
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
132
|
+
*/
|
|
133
|
+
moduleEval<T>(block: (this: Module, mod: Partial<I> & Record<string, unknown>) => T): T;
|
|
134
|
+
/**
|
|
135
|
+
* Mirrors: Ruby's Module#include into a module — vendor/ruby/v3.3.11/class.c:1179
|
|
136
|
+
* `rb_include_module`, which splices `mod` BELOW this module, so a method
|
|
137
|
+
* this module defines itself outranks the included one. A module already
|
|
138
|
+
* included is skipped (`include_modules_at`, class.c:1281,1291,1296). A
|
|
139
|
+
* module defining `appendFeatures` gets that call instead, then `included`,
|
|
140
|
+
* as `rb_mod_include` sends both (vendor/ruby/v3.3.11/eval.c:1159-1160).
|
|
141
|
+
* `ensure_includable` (class.c:1168-1176) rejects a Ruby `Class`; a TS class
|
|
142
|
+
* passed here is a class module, the spelling {@link include} already takes
|
|
143
|
+
* for a Ruby module that carries accessors, so its prototype methods are
|
|
144
|
+
* the module's method table.
|
|
145
|
+
*
|
|
146
|
+
* A plain-object module's getter and setter are methods too (`def title` /
|
|
147
|
+
* `def title=`), so the pair is carried as an accessor, uncalled. An ES
|
|
148
|
+
* module namespace (`import * as Helper`) is the exception: its exports are
|
|
149
|
+
* functions a bundler may serve through getters, so each is read and
|
|
150
|
+
* installed as the method it names.
|
|
151
|
+
*
|
|
152
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
153
|
+
*/
|
|
154
|
+
include(mod: ModuleObject): this;
|
|
155
|
+
/**
|
|
156
|
+
* Mirrors: Ruby's Module#include? — vendor/ruby/v3.3.11/class.c:1538
|
|
157
|
+
* `rb_mod_include_p`, which walks the module's ancestry, so a module
|
|
158
|
+
* included by an included module answers true.
|
|
159
|
+
*
|
|
160
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
161
|
+
*/
|
|
162
|
+
isInclude(mod2: object): boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Mirrors: Ruby's Module#define_method — vendor/ruby/v3.3.11/proc.c:2325
|
|
165
|
+
* `rb_mod_define_method`.
|
|
166
|
+
*
|
|
167
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
168
|
+
*/
|
|
169
|
+
defineMethod(name: string, body: (...args: never[]) => unknown): void;
|
|
170
|
+
/**
|
|
171
|
+
* Mirrors: Ruby's Module#instance_method — the named method, detached from
|
|
172
|
+
* this module. Ruby returns an `UnboundMethod`, which `define_method` binds
|
|
173
|
+
* into another module; the TS carrier of that is the property descriptor,
|
|
174
|
+
* which `Object.defineProperty` re-installs and which — unlike a bare
|
|
175
|
+
* function — also carries an accessor pair.
|
|
176
|
+
*
|
|
177
|
+
* vendor/ruby/v3.3.11/proc.c:2190 `rb_mod_instance_method`.
|
|
178
|
+
*
|
|
179
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
180
|
+
*/
|
|
181
|
+
instanceMethod(name: string): PropertyDescriptor | undefined;
|
|
182
|
+
/**
|
|
183
|
+
* Mirrors: Ruby's Module#ancestors — vendor/ruby/v3.3.11/class.c:1570
|
|
184
|
+
* `rb_mod_ancestors`: the module, then the modules it includes, most
|
|
185
|
+
* recently included first, each followed by its own.
|
|
186
|
+
*
|
|
187
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
188
|
+
*/
|
|
189
|
+
ancestors(): object[];
|
|
190
|
+
/**
|
|
191
|
+
* Mirrors: Ruby's Module#instance_methods — vendor/ruby/v3.3.11/class.c:1889
|
|
192
|
+
* `rb_class_instance_methods`, whose `include_super` defaults to true: the
|
|
193
|
+
* methods of the module's ancestors follow its own, and a name a nearer
|
|
194
|
+
* module undefines stays hidden.
|
|
195
|
+
*
|
|
196
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
197
|
+
*/
|
|
198
|
+
instanceMethods(includeSuper?: boolean): string[];
|
|
199
|
+
/**
|
|
200
|
+
* Mirrors: Ruby's Module#remove_method — vendor/ruby/v3.3.11/vm_method.c:1728
|
|
201
|
+
* `rb_mod_remove_method`.
|
|
202
|
+
*
|
|
203
|
+
* @noRailsEquivalent PERMANENT
|
|
204
|
+
*/
|
|
205
|
+
removeMethod(...names: string[]): this;
|
|
206
|
+
/**
|
|
207
|
+
* Mirrors: Ruby's Module#undef_method — vendor/ruby/v3.3.11/vm_method.c:1973
|
|
208
|
+
* `rb_mod_undef_method`.
|
|
209
|
+
*
|
|
210
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
211
|
+
*/
|
|
212
|
+
undefMethod(...names: string[]): this;
|
|
213
|
+
/**
|
|
214
|
+
* Mirrors: Ruby's Module#alias_method — vendor/ruby/v3.3.11/vm_method.c:2366
|
|
215
|
+
* `rb_mod_alias_method`.
|
|
216
|
+
*
|
|
217
|
+
* @noRailsEquivalent PERMANENT
|
|
218
|
+
*/
|
|
219
|
+
aliasMethod(newName: string, oldName: string): string;
|
|
220
|
+
/**
|
|
221
|
+
* Mirrors: Ruby's Module#append_features — vendor/ruby/v3.3.11/eval.c:1110
|
|
222
|
+
* `rb_mod_append_features`, the splice `include` runs before `included`.
|
|
223
|
+
* A `Module` this module included is spliced beneath it, as
|
|
224
|
+
* `include_modules_at` (vendor/ruby/v3.3.11/class.c:1253) walks the included
|
|
225
|
+
* module's own ancestry, skipping one already in `base`'s. A `Module` base is
|
|
226
|
+
* a module including this one: every class already including `base` gets it
|
|
227
|
+
* too, as `rb_include_module` walks `base`'s subclasses
|
|
228
|
+
* (vendor/ruby/v3.3.11/class.c:1189-1215).
|
|
229
|
+
*
|
|
230
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
231
|
+
*/
|
|
232
|
+
appendFeatures(base: AnyClass | Module): void;
|
|
233
|
+
/**
|
|
234
|
+
* Mirrors: Ruby's Module#prepend_features — vendor/ruby/v3.3.11/eval.c:1175
|
|
235
|
+
* `rb_mod_prepend_features`, the splice `prepend` runs before `prepended`.
|
|
236
|
+
* `rb_prepend_module` (vendor/ruby/v3.3.11/class.c:1430) moves the class's
|
|
237
|
+
* method table to an origin iclass (`ensure_origin`, class.c:1379) and
|
|
238
|
+
* splices the module between the class and that origin, so `superMethod`
|
|
239
|
+
* resumes at the class's own method. Here the origin holds the class's
|
|
240
|
+
* methods of the names the module defines; a later `include` is spliced
|
|
241
|
+
* beneath it, as `rb_include_module` splices at `RCLASS_ORIGIN`
|
|
242
|
+
* (class.c:1186). The origin is an iclass owned by the class, so
|
|
243
|
+
* `rbClassSuperclass` skips it and `methodOwner` answers the class for a
|
|
244
|
+
* method it holds.
|
|
245
|
+
*
|
|
246
|
+
* Two things MRI does have no JS counterpart. A method assigned to the
|
|
247
|
+
* class after the prepend lands on the class, above the module, where
|
|
248
|
+
* Ruby's `def` lands in the origin; and a moved method that calls
|
|
249
|
+
* `super.name()` resumes from the class, its home object, and so re-enters
|
|
250
|
+
* the module. A class whose own property of one of the module's names
|
|
251
|
+
* cannot be moved raises `TypeError`.
|
|
252
|
+
*
|
|
253
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
254
|
+
*/
|
|
255
|
+
prependFeatures(base: AnyClass): void;
|
|
256
|
+
/**
|
|
257
|
+
* Mirrors: Ruby's Module#extend_object — vendor/ruby/v3.3.11/eval.c:1746
|
|
258
|
+
* `rb_mod_extend_object`, which `rb_extend_object` (:1713) runs as
|
|
259
|
+
* `rb_include_module(rb_singleton_class(obj), module)`: the module's link is
|
|
260
|
+
* spliced between `obj` and its class, so a later `extend` sits above it and
|
|
261
|
+
* `superMethod` resumes the lookup at the next link. A module already in
|
|
262
|
+
* `obj`'s ancestry is skipped, as `include_modules_at` skips one
|
|
263
|
+
* (vendor/ruby/v3.3.11/class.c:1281,1291,1296). A frozen object's singleton
|
|
264
|
+
* class is frozen, so `rb_class_modify_check` (vendor/ruby/v3.3.11/eval.c:429)
|
|
265
|
+
* raises `FrozenError` first.
|
|
266
|
+
*
|
|
267
|
+
* One link is made per extended object, so singleton links are held through
|
|
268
|
+
* `WeakRef`s that `relinkIncluders` still walks, keeping a later
|
|
269
|
+
* `defineMethod` visible on an already-extended object as Ruby's shared
|
|
270
|
+
* method table does, without retaining the object.
|
|
271
|
+
*
|
|
272
|
+
* A class's constructor reaches its superclass through the same prototype
|
|
273
|
+
* link (`super()` reads `Object.getPrototypeOf(klass)`), so the link spliced
|
|
274
|
+
* above a class is itself a subclass of the class's parent.
|
|
275
|
+
*
|
|
276
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
277
|
+
*/
|
|
278
|
+
extendObject(obj: object): void;
|
|
279
|
+
/**
|
|
280
|
+
* Mirrors: Ruby's `super` from one of this module's methods —
|
|
281
|
+
* vendor/ruby/v3.3.11/vm_insnhelper.c:4648 `vm_search_super_method`, the lookup
|
|
282
|
+
* `Method#super_method` exposes (vendor/ruby/v3.3.11/proc.c:3391): resume the method
|
|
283
|
+
* search at `RCLASS_SUPER` of the iclass this module contributed to
|
|
284
|
+
* `receiver`'s ancestry. Answers the next method bound to `receiver`, or
|
|
285
|
+
* `undefined` where Ruby's `super_method` answers nil.
|
|
286
|
+
*
|
|
287
|
+
* A JS function's `super` is fixed to its home object, which for a carrier
|
|
288
|
+
* method is the module's own table, not the includer's link, so the link is
|
|
289
|
+
* found on the receiver's prototype chain instead.
|
|
290
|
+
*
|
|
291
|
+
* Every ancestry ends in `Object`, which includes `Kernel`, so a `super` that
|
|
292
|
+
* no link beneath the caller answers reaches `Kernel`'s method. No JS object
|
|
293
|
+
* stands at that root, so the search ends in the `Kernel` module's table.
|
|
294
|
+
*
|
|
295
|
+
* A reader and writer generated as one accessor pair are two Ruby methods,
|
|
296
|
+
* `name` and `name=`, so `name` answers the next getter and `name=` the next
|
|
297
|
+
* setter, each looked up independently the way Ruby looks each method up.
|
|
298
|
+
*
|
|
299
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
300
|
+
*/
|
|
301
|
+
superMethod(receiver: object, name: string): ((...args: unknown[]) => unknown) | undefined;
|
|
302
|
+
/**
|
|
303
|
+
* Mirrors: Ruby's Module#attr_reader — vendor/ruby/v3.3.11/object.c:2279
|
|
304
|
+
* `rb_mod_attr_reader`.
|
|
305
|
+
*
|
|
306
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
307
|
+
*/
|
|
308
|
+
attrReader(...argv: string[]): void;
|
|
309
|
+
/**
|
|
310
|
+
* Mirrors: Ruby's Module#attr_writer — vendor/ruby/v3.3.11/object.c:2335
|
|
311
|
+
* `rb_mod_attr_writer`.
|
|
312
|
+
*
|
|
313
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
314
|
+
*/
|
|
315
|
+
attrWriter(...argv: string[]): void;
|
|
316
|
+
/**
|
|
317
|
+
* Mirrors: Ruby's Module#method_defined? — vendor/ruby/v3.3.11/vm_method.c:2055
|
|
318
|
+
* `rb_mod_method_defined`.
|
|
319
|
+
*
|
|
320
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
321
|
+
*/
|
|
322
|
+
isMethodDefined(name: string): boolean;
|
|
323
|
+
/**
|
|
324
|
+
* Mirrors: Ruby's Module#dup — vendor/ruby/v3.3.11/object.c:591 `rb_obj_dup`,
|
|
325
|
+
* whose `initialize_copy` is vendor/ruby/v3.3.11/class.c:524 `rb_mod_init_copy`:
|
|
326
|
+
* the copy gets its own method table and a clone of the singleton class
|
|
327
|
+
* (`rb_singleton_class_clone`, :545-548), and shares the modules it includes.
|
|
328
|
+
* Nothing that already includes the original includes the copy.
|
|
329
|
+
*
|
|
330
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
331
|
+
*/
|
|
332
|
+
dup(): this;
|
|
333
|
+
}
|
|
334
|
+
export { methodCacheSerial, rbClearMethodCache };
|
|
335
|
+
/**
|
|
336
|
+
* Symbol key for Ruby's Module#included callback, which `rb_mod_include` fires
|
|
337
|
+
* on the module once `append_features` has spliced it into the ancestry
|
|
338
|
+
* (vendor/ruby/v3.3.11/eval.c:1160). Using a symbol avoids collisions with real method
|
|
339
|
+
* names.
|
|
340
|
+
*
|
|
341
|
+
* @noRailsEquivalent PERMANENT — Ruby names the hook with an ordinary method
|
|
342
|
+
* definition on the module; TypeScript has no such lifecycle hook, so the key
|
|
343
|
+
* carries the name instead.
|
|
344
|
+
*/
|
|
345
|
+
export declare const included: unique symbol;
|
|
346
|
+
/**
|
|
347
|
+
* Symbol key for Ruby's Module#extended callback, which `rb_obj_extend` fires
|
|
348
|
+
* on the module after `extend_object` has copied its methods onto the object
|
|
349
|
+
* (vendor/ruby/v3.3.11/eval.c:1795).
|
|
350
|
+
*
|
|
351
|
+
* @noRailsEquivalent PERMANENT — the TypeScript spelling of a Ruby lifecycle
|
|
352
|
+
* hook, which the language has no equivalent of.
|
|
353
|
+
*/
|
|
354
|
+
export declare const extended: unique symbol;
|
|
355
|
+
/**
|
|
356
|
+
* Symbol key for Ruby's Class#inherited callback, which `rb_class_inherited`
|
|
357
|
+
* calls on the superclass with the new subclass
|
|
358
|
+
* (vendor/ruby/v3.3.11/class.c:963). JS runs nothing when a class is defined,
|
|
359
|
+
* so the call is made where trails first learns of the subclass:
|
|
360
|
+
* `DescendantsTracker.registerSubclass` adding a new edge (CLAUDE.md
|
|
361
|
+
* § "`inherited` is deferred to own-property memo guards").
|
|
362
|
+
*
|
|
363
|
+
* @noRailsEquivalent PERMANENT
|
|
364
|
+
*/
|
|
365
|
+
export declare const inherited: unique symbol;
|
|
366
|
+
/**
|
|
367
|
+
* Symbol key for Ruby's Module#prepended callback, which `rb_mod_prepend`
|
|
368
|
+
* fires on the module once `prepend_features` has spliced it into the
|
|
369
|
+
* ancestry, on every call (vendor/ruby/v3.3.11/eval.c:1215).
|
|
370
|
+
*
|
|
371
|
+
* @noRailsEquivalent PERMANENT — the TypeScript spelling of a Ruby lifecycle
|
|
372
|
+
* hook, which the language has no equivalent of.
|
|
373
|
+
*/
|
|
374
|
+
export declare const prepended: unique symbol;
|
|
375
|
+
/**
|
|
376
|
+
* Ruby's `Module#<` — is `mod` in `klass`'s ancestry?
|
|
377
|
+
*
|
|
378
|
+
* `ActiveRecord::AttributeMethods::Dirty`'s `included do` block asks exactly
|
|
379
|
+
* this (`activerecord/lib/active_record/attribute_methods/dirty.rb:44-47`,
|
|
380
|
+
* `if self < ::ActiveRecord::Timestamp`), and there is no other way to ask it
|
|
381
|
+
* here: JavaScript keeps no ancestry record of a mixin, since `include()`
|
|
382
|
+
* copies a module's members onto the prototype rather than splicing a link for
|
|
383
|
+
* it. The registry `include()` keeps is that record.
|
|
384
|
+
*
|
|
385
|
+
* Mirrors: Ruby's Module#include? — vendor/ruby/v3.3.11/class.c:1538
|
|
386
|
+
* `rb_mod_include_p`.
|
|
387
|
+
*
|
|
388
|
+
* @noRailsEquivalent PERMANENT — Ruby spells this `<`, an operator TypeScript
|
|
389
|
+
* cannot define; the predicate carries the same question at a callable name.
|
|
390
|
+
*/
|
|
391
|
+
export declare function isModuleIncluded(klass: {
|
|
392
|
+
prototype: object;
|
|
393
|
+
} | ModuleObject, mod: ModuleObject | AnyClass | Module): boolean;
|
|
394
|
+
/**
|
|
395
|
+
* Ruby's `Module#included_modules`: every module in `mod`'s ancestry, most
|
|
396
|
+
* recently mixed in first. A class's singleton ancestry is its constructor's
|
|
397
|
+
* static chain, so `includedModules({ prototype: klass })` answers
|
|
398
|
+
* `klass.singleton_class.included_modules`.
|
|
399
|
+
*
|
|
400
|
+
* Mirrors: Ruby's Module#included_modules — vendor/ruby/v3.3.11/class.c:1508
|
|
401
|
+
* `rb_mod_included_modules`.
|
|
402
|
+
*
|
|
403
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
404
|
+
*/
|
|
405
|
+
export declare function includedModules(mod: {
|
|
406
|
+
prototype: object;
|
|
407
|
+
}): unknown[];
|
|
408
|
+
/**
|
|
409
|
+
* Ruby's `Module#ancestors`: the class, the modules mixed into it most
|
|
410
|
+
* recently first, and then the same for each superclass up to `Object`.
|
|
411
|
+
* `rb_mod_ancestors` reads the iclass of an included module off the
|
|
412
|
+
* superclass chain; the registry `include()` keeps on each prototype is that
|
|
413
|
+
* record here.
|
|
414
|
+
*
|
|
415
|
+
* `Object.prototype` is the seat of `Object`, whose own ancestry
|
|
416
|
+
* (`Kernel`, `BasicObject`) no JS prototype carries.
|
|
417
|
+
*
|
|
418
|
+
* Mirrors: Ruby's Module#ancestors — vendor/ruby/v3.3.11/class.c:1570
|
|
419
|
+
* `rb_mod_ancestors`.
|
|
420
|
+
*
|
|
421
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
422
|
+
*/
|
|
423
|
+
export declare function rbModAncestors(mod: {
|
|
424
|
+
prototype: object;
|
|
425
|
+
} | ModuleObject): object[];
|
|
426
|
+
/**
|
|
427
|
+
* `rb_obj_is_kind_of` (`vendor/ruby/v3.3.11/object.c:889`), `Object#kind_of?`
|
|
428
|
+
* and `Module#===`: whether `c` is in the ancestry of `obj`'s class. A plain
|
|
429
|
+
* object is a module once seated or built by `defineModule`, as `include()`
|
|
430
|
+
* takes one, and JS's own `Set` is
|
|
431
|
+
* the seat of the `Set` that reopens it (`class Set extends JsSet`). A Symbol
|
|
432
|
+
* is a colon-spelled string, whose class `rbObjClass` answers as `String`, so
|
|
433
|
+
* `Symbol === obj` and `String === obj` are answered by the spelling.
|
|
434
|
+
*
|
|
435
|
+
* @noRailsEquivalent PERMANENT
|
|
436
|
+
*/
|
|
437
|
+
export declare function rbObjIsKindOf(obj: unknown, c: unknown): boolean;
|
|
438
|
+
/**
|
|
439
|
+
* `rb_class_inherited_p` (`vendor/ruby/v3.3.11/object.c:1778`), `Module#<=`:
|
|
440
|
+
* true when `mod` is `arg` or has it in its ancestry, false when `arg` has
|
|
441
|
+
* `mod` in its own, and nil when the two are unrelated. The class-to-class
|
|
442
|
+
* arm reads `RCLASS_SUPERCLASS_DEPTH`, a cache no JS class carries, so both
|
|
443
|
+
* arms search the ancestry.
|
|
444
|
+
*
|
|
445
|
+
* @noRailsEquivalent PERMANENT
|
|
446
|
+
*/
|
|
447
|
+
export declare function rbClassInheritedP(mod: unknown, arg: unknown): boolean | null;
|
|
448
|
+
/**
|
|
449
|
+
* `rb_mod_ge` (`vendor/ruby/v3.3.11/object.c:1862`), `Module#>=`.
|
|
450
|
+
*
|
|
451
|
+
* @noRailsEquivalent PERMANENT
|
|
452
|
+
*/
|
|
453
|
+
export declare function rbModGe(mod: unknown, arg: unknown): boolean | null;
|
|
454
|
+
/**
|
|
455
|
+
* `rb_mod_gt` (`vendor/ruby/v3.3.11/object.c:1885`), `Module#>`.
|
|
456
|
+
*
|
|
457
|
+
* @noRailsEquivalent PERMANENT
|
|
458
|
+
*/
|
|
459
|
+
export declare function rbModGt(mod: unknown, arg: unknown): boolean | null;
|
|
460
|
+
/**
|
|
461
|
+
* `rb_mod_instance_method` (`vendor/ruby/v3.3.11/proc.c:2190`), `Module#instance_method`,
|
|
462
|
+
* answering the `owner` (`method_owner`, `vendor/ruby/v3.3.11/proc.c:1988`): the
|
|
463
|
+
* {@link rbModAncestors} entry that defines `mid`. That is the `Module` an
|
|
464
|
+
* iclass link stands for, the module `include()` copied the entry from, most
|
|
465
|
+
* recently included first, or the class the prototype belongs to.
|
|
466
|
+
*
|
|
467
|
+
* An `Object.prototype` member raises `NameError`: no Ruby class defines it,
|
|
468
|
+
* the line {@link rbModMethodDefined} draws for `Module#method_defined?`.
|
|
469
|
+
*
|
|
470
|
+
* @noRailsEquivalent PERMANENT
|
|
471
|
+
*/
|
|
472
|
+
export declare function rbModInstanceMethod(mod: {
|
|
473
|
+
prototype: object;
|
|
474
|
+
}, mid: string): UnboundMethod;
|
|
475
|
+
/**
|
|
476
|
+
* Ruby's `UnboundMethod`, as far as trails reads one: `owner`
|
|
477
|
+
* (`method_owner`, `vendor/ruby/v3.3.11/proc.c:1988`), `super_method`
|
|
478
|
+
* (`method_super_method`, `:3391`) and `bind_call` (`umethod_bind_call`, `:2713`).
|
|
479
|
+
*
|
|
480
|
+
* @noRailsEquivalent PERMANENT
|
|
481
|
+
*/
|
|
482
|
+
export interface UnboundMethod {
|
|
483
|
+
owner: object;
|
|
484
|
+
superMethod(): UnboundMethod | null;
|
|
485
|
+
bindCall(recv: object, ...args: unknown[]): unknown;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* `method_owner` (`vendor/ruby/v3.3.11/proc.c:1988`) for the entry `mid` names from
|
|
489
|
+
* `start`, or nil when there is none. An entry `extend()` copied onto an
|
|
490
|
+
* object is owned by the module it came from, and a class's own static by the
|
|
491
|
+
* class, which stands for its singleton class.
|
|
492
|
+
*
|
|
493
|
+
* @noRailsEquivalent PERMANENT
|
|
494
|
+
*/
|
|
495
|
+
export declare function methodOwner(start: object, mid: string): object | null;
|
|
496
|
+
/**
|
|
497
|
+
* Symbol key for the per-section visibility record `defineModule` stamps onto
|
|
498
|
+
* the flat module object it returns. Symbol-keyed so it never collides with a
|
|
499
|
+
* real method name, and so `Object.keys()` consumers see the module unchanged.
|
|
500
|
+
*
|
|
501
|
+
* The sections it records are the ones Ruby reads back through
|
|
502
|
+
* `Module#private_instance_methods` — vendor/ruby/v3.3.11/class.c:1927
|
|
503
|
+
* `rb_class_private_instance_methods`.
|
|
504
|
+
*
|
|
505
|
+
* @noRailsEquivalent PERMANENT — Ruby carries visibility on the method entry
|
|
506
|
+
* itself; a TS object literal has nowhere to put it but a side table.
|
|
507
|
+
*/
|
|
508
|
+
export declare const moduleVisibility: unique symbol;
|
|
509
|
+
export interface ModuleVisibility {
|
|
510
|
+
public: string[];
|
|
511
|
+
protected: string[];
|
|
512
|
+
private: string[];
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Compose a module from its visibility sections, the way a Ruby module body
|
|
516
|
+
* separates them with statement-position `private` / `protected` keywords.
|
|
517
|
+
*
|
|
518
|
+
* Returns the flat composition in section order — public, then protected, then
|
|
519
|
+
* private — so `include()` and `Included<typeof ...>` consumers see exactly the
|
|
520
|
+
* object a hand-written spread produced. The section membership is additionally
|
|
521
|
+
* stamped under `moduleVisibility` for `publicInstanceMethods` to read.
|
|
522
|
+
*
|
|
523
|
+
* The sections must be pairwise disjoint. A name in two sections is silently
|
|
524
|
+
* won by the last spread, which aliases like `buildHavingClause: buildWhereClause`
|
|
525
|
+
* (query_methods.rb:1654) make plausible, so it is asserted rather than trusted.
|
|
526
|
+
*
|
|
527
|
+
* Mirrors: Ruby's Module.new body — vendor/ruby/v3.3.11/object.c:1950
|
|
528
|
+
* `rb_mod_initialize`.
|
|
529
|
+
*
|
|
530
|
+
* @noRailsEquivalent PERMANENT — Ruby declares member visibility with
|
|
531
|
+
* statement-position `private` / `protected` inside the module body; a TS
|
|
532
|
+
* object literal has no statement position, so the sections must be named
|
|
533
|
+
* values and composed explicitly.
|
|
534
|
+
*/
|
|
535
|
+
export declare function defineModule<Pub extends ModuleObject, Prot extends ModuleObject = Record<never, never>, Priv extends ModuleObject = Record<never, never>>(publicSection: Pub, protectedSection?: Prot, privateSection?: Priv): Pub & Prot & Priv;
|
|
536
|
+
/**
|
|
537
|
+
* Mirrors: Ruby's Module#public_instance_methods — vendor/ruby/v3.3.11/class.c:1942
|
|
538
|
+
* `rb_class_public_instance_methods` — the module's public instance methods,
|
|
539
|
+
* own-only when `includeSuper` is false.
|
|
540
|
+
*
|
|
541
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
542
|
+
*
|
|
543
|
+
* Known limitation: TypeScript's `private` / `protected` are erased at runtime,
|
|
544
|
+
* so the class form cannot see them and reports every prototype member. Only a
|
|
545
|
+
* `#`-private field and a `defineModule` section are visible here; enforcement
|
|
546
|
+
* of the rest is a compare-time gate rather than this runtime walk.
|
|
547
|
+
*
|
|
548
|
+
* `includeSuper` is inert on a `Module`, whose method table is one flat table
|
|
549
|
+
* of its own methods.
|
|
550
|
+
*/
|
|
551
|
+
export declare function publicInstanceMethods(mod: ModuleObject | AnyClass | Module, includeSuper?: boolean): string[];
|
|
552
|
+
type CallableMethods<M extends object> = {
|
|
553
|
+
[K in keyof M as K extends string ? M[K] extends AnyFunction ? K : never : never]: unknown extends ThisParameterType<M[K]> ? M[K] : M[K] extends (this: never, ...args: infer A) => infer R ? (...args: A) => R : never;
|
|
554
|
+
};
|
|
555
|
+
export type Included<M extends object> = CallableMethods<M extends Module<infer I> ? I : M>;
|
|
556
|
+
/**
|
|
557
|
+
* Mirrors: Ruby's Module#include — vendor/ruby/v3.3.11/eval.c:1139 `rb_mod_include`,
|
|
558
|
+
* backed by vendor/ruby/v3.3.11/class.c:1179 `rb_include_module`.
|
|
559
|
+
*
|
|
560
|
+
* @noRailsEquivalent PERMANENT — a Ruby core-language primitive, which Rails
|
|
561
|
+
* uses but does not define.
|
|
562
|
+
*/
|
|
563
|
+
export declare function include(klass: AnyClass | object, mod: ModuleObject | AnyClass | Module): void;
|
|
564
|
+
/**
|
|
565
|
+
* Mirrors: Ruby's Module#append_features — vendor/ruby/v3.3.11/eval.c:1110
|
|
566
|
+
* `rb_mod_append_features`, the step `include` runs before `included`, which a
|
|
567
|
+
* module overriding `append_features` (`ActiveSupport::Concern`) calls as
|
|
568
|
+
* `super`. A plain-object module's instance methods are its enumerable own
|
|
569
|
+
* members; the modules it included are appended first, as `include_modules_at`
|
|
570
|
+
* (vendor/ruby/v3.3.11/class.c:1253) walks the included module's ancestry and
|
|
571
|
+
* skips one `klass` already has, so the module's own methods outrank them.
|
|
572
|
+
*
|
|
573
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
574
|
+
*/
|
|
575
|
+
export declare function rbModAppendFeatures(klass: AnyClass | object, mod: ModuleObject | AnyClass | Module): void;
|
|
576
|
+
/** @noRailsEquivalent PERMANENT */
|
|
577
|
+
export declare const shadowsIncluded: unique symbol;
|
|
578
|
+
/** @noRailsEquivalent PERMANENT */
|
|
579
|
+
export declare function displacedIncludedMembers(klass: AnyClass): Map<string | symbol, object[]>;
|
|
580
|
+
/**
|
|
581
|
+
* Mirrors: Ruby's `super` — vendor/ruby/v3.3.11/vm_eval.c:366 `rb_call_super`.
|
|
582
|
+
* A plain-object module's method reaches the next method of its name in the
|
|
583
|
+
* includer's ancestry: the one `include()` found on the includer's prototype
|
|
584
|
+
* when it copied `method` there, seated under `method`'s own slot. With none
|
|
585
|
+
* seated, the search ends in `Kernel`, where every Ruby ancestry ends.
|
|
586
|
+
*
|
|
587
|
+
* A function seated at two places in one ancestry (a module included into a
|
|
588
|
+
* class and then into its superclass below a prepend, both copies kept by
|
|
589
|
+
* `include_modules_at`, vendor/ruby/v3.3.11/class.c:1253) has one slot, so
|
|
590
|
+
* the lower copy's seat shadows the upper one's; the upper copy's seat is
|
|
591
|
+
* read off the link it was found at. MRI runs the upper copy a second time
|
|
592
|
+
* (`["mod", "prepended", "mod", "base"]` for the subclass in ruby 3.3.11);
|
|
593
|
+
* trails skips it, since one function's slot cannot answer from two ancestry
|
|
594
|
+
* positions and an awaited body carries no frame to tell the copies apart.
|
|
595
|
+
*
|
|
596
|
+
* @inventedArm skip — PERMANENT
|
|
597
|
+
* @noRailsEquivalent PERMANENT
|
|
598
|
+
*/
|
|
599
|
+
export declare function rbCallSuper(receiver: object, method: AnyFunction, ...args: unknown[]): unknown;
|
|
600
|
+
export type Extended<M extends object> = CallableMethods<M>;
|
|
601
|
+
type ExtendedAll<M> = (M extends object ? (host: Extended<M>) => void : never) extends (host: infer I) => void ? I : never;
|
|
602
|
+
/**
|
|
603
|
+
* Mirrors: Ruby's Object#clone — vendor/ruby/v3.3.11/object.c:536 `rb_obj_clone`, via
|
|
604
|
+
* `rb_obj_clone_setup` (:457-527): a new object of the same class carrying a
|
|
605
|
+
* copy of the receiver's singleton class and instance variables (`init_copy`),
|
|
606
|
+
* then `initialize_clone(orig)` dispatched on the copy, which is frozen after
|
|
607
|
+
* that hook runs when the receiver is. The singleton class is copied, not
|
|
608
|
+
* shared, so the clone's `extend()` registries are its own. A JS primitive is
|
|
609
|
+
* MRI's `special_object_p` (:380-393) and is returned as is (:539), as is a
|
|
610
|
+
* Temporal value; an array is allocated as one (`rb_obj_alloc`), so its
|
|
611
|
+
* elements, which Ruby copies in `Array#initialize_copy` (`array.c:8613`,
|
|
612
|
+
* `rb_ary_replace`), land on a real array, and so are a JS `Date`, `Map`, `Set`,
|
|
613
|
+
* `RegExp` and typed array. A typed array is copied through the constructor
|
|
614
|
+
* its `Symbol.toStringTag` names, since a Node `Buffer`'s `slice` answers a
|
|
615
|
+
* view onto the same memory and its own constructor is the deprecated
|
|
616
|
+
* `Buffer()`. A class with an allocator ({@link rbDefineAllocFunc}) is
|
|
617
|
+
* allocated through it. The copy hook is found as a method entry.
|
|
618
|
+
*
|
|
619
|
+
* Ruby's `Object#initialize_clone` / `#initialize_dup` default to
|
|
620
|
+
* `initialize_copy` (`rb_obj_init_clone` / `rb_obj_init_dup_clone`, object.c:4382-4383), so a
|
|
621
|
+
* receiver that defines only `initializeCopy` gets it here. This and
|
|
622
|
+
* {@link rbObjDup} are the one spelling of Ruby `obj.clone` / `obj.dup`; a
|
|
623
|
+
* class ports `initialize_clone` / `initialize_dup` / `initialize_copy` at
|
|
624
|
+
* their Rails names and never open-codes the copy.
|
|
625
|
+
*
|
|
626
|
+
* @noRailsEquivalent PERMANENT — a Ruby core-language primitive, which Rails
|
|
627
|
+
* uses but does not define.
|
|
628
|
+
*/
|
|
629
|
+
export declare function rbObjClone<T>(obj: T): T;
|
|
630
|
+
/**
|
|
631
|
+
* Mirrors: Ruby's Object#dup — vendor/ruby/v3.3.11/object.c:591 `rb_obj_dup`, via
|
|
632
|
+
* `rb_obj_dup_setup` (:543-549): a new object of `rb_obj_class(obj)` — the
|
|
633
|
+
* singleton class and the modules it was `extend`ed with are not carried —
|
|
634
|
+
* holding a copy of the instance variables, then `initialize_dup(orig)`
|
|
635
|
+
* dispatched on the copy. The frozen state is not carried either. A primitive
|
|
636
|
+
* and an array are handled as in {@link rbObjClone}.
|
|
637
|
+
*
|
|
638
|
+
* @noRailsEquivalent PERMANENT — a Ruby core-language primitive, which Rails
|
|
639
|
+
* uses but does not define.
|
|
640
|
+
*/
|
|
641
|
+
export declare function rbObjDup<T>(obj: T): T;
|
|
642
|
+
/**
|
|
643
|
+
* `rb_define_alloc_func` (`vendor/ruby/v3.3.11/vm_method.c:1270`): the allocator
|
|
644
|
+
* for `klass` and its subclasses (`rb_get_alloc_func`, `:1286`), declared when
|
|
645
|
+
* instances hold state `Object.create` cannot make (`#private` fields, a Proxy).
|
|
646
|
+
*
|
|
647
|
+
* @noRailsEquivalent PERMANENT
|
|
648
|
+
*/
|
|
649
|
+
export declare function rbDefineAllocFunc<K extends abstract new (...args: never) => object>(klass: K, func: (klass: K) => InstanceType<K>): void;
|
|
650
|
+
/**
|
|
651
|
+
* `rb_get_alloc_func` (`vendor/ruby/v3.3.11/vm_method.c:1286`).
|
|
652
|
+
*
|
|
653
|
+
* @noRailsEquivalent PERMANENT
|
|
654
|
+
*/
|
|
655
|
+
export declare function rbGetAllocFunc(klass: unknown): ((klass: never) => object) | undefined;
|
|
656
|
+
/**
|
|
657
|
+
* `rb_class_new_instance` (`vendor/ruby/v3.3.11/object.c:2158`), `Class#new`:
|
|
658
|
+
* allocate, then `initialize` with `args`. A JS constructor is both halves, so
|
|
659
|
+
* a class is built with `new`, reached past a `protected` constructor; that is
|
|
660
|
+
* how a `static async new` builds `this`, and why its result is typed as the
|
|
661
|
+
* receiver's instance. `empty_hash_alloc` (`vendor/ruby/v3.3.11/hash.c:1488`)
|
|
662
|
+
* is a `Hash`, and a String is a primitive (CLAUDE.md, "Ruby Strings are JS
|
|
663
|
+
* string primitives"), so `empty_str_alloc`
|
|
664
|
+
* (`vendor/ruby/v3.3.11/string.c:858`) is `""`. `Class.new` is an anonymous
|
|
665
|
+
* class (`rb_class_initialize`, `vendor/ruby/v3.3.11/object.c:2007`), and
|
|
666
|
+
* `Regexp.new` takes one to three arguments (`rb_reg_initialize_m`,
|
|
667
|
+
* `vendor/ruby/v3.3.11/re.c:3957`).
|
|
668
|
+
*
|
|
669
|
+
* @noRailsEquivalent PERMANENT
|
|
670
|
+
*/
|
|
671
|
+
export declare function rbClassNewInstance<T>(klass: {
|
|
672
|
+
prototype: T;
|
|
673
|
+
}, ...args: unknown[]): T;
|
|
674
|
+
/**
|
|
675
|
+
* Ruby-style `prepend` for mixing module methods into a class *above* it.
|
|
676
|
+
*
|
|
677
|
+
* Ruby's `prepend` inserts the module ahead of the class in the ancestry, so a
|
|
678
|
+
* method the module defines wins over the same method in the class body — the
|
|
679
|
+
* one behavioural difference from `include`, which loses to it. Here that is a
|
|
680
|
+
* plain assignment onto the class prototype.
|
|
681
|
+
*
|
|
682
|
+
* The method it replaces is seated under the module method's super slot, so
|
|
683
|
+
* the module reaches it with {@link rbCallSuper}, as Ruby's `super` does.
|
|
684
|
+
*
|
|
685
|
+
* A module whose method table is already in the ancestry is skipped
|
|
686
|
+
* whole, the way `include_modules_at` skips one
|
|
687
|
+
* (vendor/ruby/v3.3.11/class.c:1281,1291,1296).
|
|
688
|
+
*
|
|
689
|
+
* Mirrors: Ruby's Module#prepend — vendor/ruby/v3.3.11/eval.c:1196 `rb_mod_prepend`,
|
|
690
|
+
* backed by vendor/ruby/v3.3.11/class.c:1430 `rb_prepend_module`.
|
|
691
|
+
*
|
|
692
|
+
* @noRailsEquivalent PERMANENT — a Ruby core-language primitive, which Rails
|
|
693
|
+
* uses but does not define.
|
|
694
|
+
*/
|
|
695
|
+
export declare function prepend(target: AnyClass | (abstract new (...args: never) => object) | {
|
|
696
|
+
prototype: object;
|
|
697
|
+
}, mod: ModuleObject | AnyClass | Module): void;
|
|
698
|
+
/**
|
|
699
|
+
* Mirrors: Ruby's Module#prepend_features — vendor/ruby/v3.3.11/eval.c:1175
|
|
700
|
+
* `rb_mod_prepend_features`, the step `prepend` runs before `prepended`, which
|
|
701
|
+
* `ActiveSupport::Concern#prepend_features` calls as `super`. A plain-object
|
|
702
|
+
* module's non-enumerable members are its singleton methods, which `extend`
|
|
703
|
+
* installs, so only its enumerable members are prepended.
|
|
704
|
+
*
|
|
705
|
+
* @noRailsEquivalent PERMANENT — a Ruby core method, not a Rails one.
|
|
706
|
+
*/
|
|
707
|
+
export declare function rbModPrependFeatures(klass: AnyClass, mod: ModuleObject | AnyClass | Module): void;
|
|
708
|
+
/**
|
|
709
|
+
* Ruby-style `extend` for mixing module methods onto a class as static methods.
|
|
710
|
+
*
|
|
711
|
+
* In Ruby, `extend SomeModule` copies the module's methods onto the
|
|
712
|
+
* object itself (not its prototype). When used on a class, this makes
|
|
713
|
+
* the methods available as class-level (static) methods.
|
|
714
|
+
*
|
|
715
|
+
* Precedence follows Ruby's singleton ancestry, the way `include()`'s does on
|
|
716
|
+
* the instance side: `include SomeModule` puts `SomeModule::ClassMethods`
|
|
717
|
+
* BELOW the class body (concern.rb:135-138), so a class-body `static` wins over
|
|
718
|
+
* the module's member of that name, while a later `extend()` wins over an
|
|
719
|
+
* earlier one. Accessor halves are resolved independently, since Ruby reads a
|
|
720
|
+
* getter (`key`) and a setter (`key=`) as two methods where TypeScript shares
|
|
721
|
+
* one property name between them. The `name` a class is born with, declared
|
|
722
|
+
* or an expression, is not a method its body defines: it stands for
|
|
723
|
+
* `Module#name`, which a module method on the singleton class is found before,
|
|
724
|
+
* so a module's `name` replaces it. A born `name` is the non-writable one; a
|
|
725
|
+
* `static name` field or accessor the class body declares is not, and wins.
|
|
726
|
+
*
|
|
727
|
+
* Mirrors: Ruby's Object#extend — vendor/ruby/v3.3.11/eval.c:1778 `rb_obj_extend`,
|
|
728
|
+
* which returns the receiver (:1800). `rb_extend_object` (:1713-1716) is
|
|
729
|
+
* `rb_include_module` on the receiver's singleton class, so the module's
|
|
730
|
+
* ancestors come with it: a plain-object module's prototype chain is walked,
|
|
731
|
+
* nearest first, as `include()` walks it.
|
|
732
|
+
*
|
|
733
|
+
* @noRailsEquivalent PERMANENT — a Ruby core-language primitive, which Rails
|
|
734
|
+
* uses but does not define.
|
|
735
|
+
*
|
|
736
|
+
* Usage:
|
|
737
|
+
* extend(Base, ConnectionHandlingMethods);
|
|
738
|
+
* // Now Base.connectedTo(...) works
|
|
739
|
+
*/
|
|
740
|
+
export declare function extend<T extends AnyClass | object, M extends ModuleObject | AnyClass | Module = ModuleObject | AnyClass | Module>(klass: T, ...argv: M[]): T & ExtendedAll<M>;
|
|
741
|
+
/** @noRailsEquivalent PERMANENT */
|
|
742
|
+
export interface KernelModule {
|
|
743
|
+
dup(this: object): object;
|
|
744
|
+
initializeCopy(this: object, orig: unknown): object;
|
|
745
|
+
initializeDup(this: object, orig: unknown): object;
|
|
746
|
+
initializeClone(this: object, orig: unknown): object;
|
|
747
|
+
freeze(this: object): object;
|
|
748
|
+
abort: typeof abort;
|
|
749
|
+
rand: typeof kernelRand;
|
|
750
|
+
srand: typeof kernelSrand;
|
|
751
|
+
require: typeof rbFRequireFile;
|
|
752
|
+
prettyPrint(this: object, q: unknown): void;
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* Ruby's `Kernel`, the module `Object` includes and so the last stop of every
|
|
756
|
+
* method search. It holds the instance methods a module's `super` reaches when
|
|
757
|
+
* nothing beneath it in the receiver's ancestry defines one: `initialize_dup`
|
|
758
|
+
* and `initialize_clone` (vendor/ruby/v3.3.11/object.c:654
|
|
759
|
+
* `rb_obj_init_dup_clone` and :671 `rb_obj_init_clone`, which send
|
|
760
|
+
* `initialize_copy`, whose default is :634 `rb_obj_init_copy`; `initialize_clone`'s `freeze:` keyword is not ported) and `freeze` (vendor/ruby/v3.3.11/object.c:1284
|
|
761
|
+
* `rb_obj_freeze`), defined at vendor/ruby/v3.3.11/object.c:4382,4385. A gem that reopens
|
|
762
|
+
* `Object` defines its method here, as ActiveSupport does for `as_json`.
|
|
763
|
+
* `abort` is the module function `Kernel.abort` (`rb_f_abort`,
|
|
764
|
+
* vendor/ruby/v3.3.11/process.c:4536), and `rand` the module function `Kernel.rand`
|
|
765
|
+
* (`rb_f_rand`, vendor/ruby/v3.3.11/random.c:1684, defined at :1840), and `require`
|
|
766
|
+
* `Kernel#require` (`rb_f_require`, vendor/ruby/v3.3.11/load.c:1022), each seated by
|
|
767
|
+
* `index.ts`, which loads every module involved. A gem that decorates `require`
|
|
768
|
+
* (Zeitwerk's `core_ext/kernel.rb`) reassigns that seat.
|
|
769
|
+
*
|
|
770
|
+
* @noRailsEquivalent PERMANENT
|
|
771
|
+
*/
|
|
772
|
+
export declare const Kernel: KernelModule;
|
|
773
|
+
/**
|
|
774
|
+
* `rb_cModule` (`vendor/ruby/v3.3.11/object.c:4202`), `Class`'s superclass.
|
|
775
|
+
* @noRailsEquivalent PERMANENT
|
|
776
|
+
*/
|
|
777
|
+
export declare const rbCModule: typeof Module;
|
|
778
|
+
//# sourceMappingURL=include.d.ts.map
|