@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
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
const HEADONLY = new WeakMap();
|
|
2
|
+
const SEARCH = new WeakMap();
|
|
3
|
+
const REGS = new WeakMap();
|
|
4
|
+
const PREV = new WeakMap();
|
|
5
|
+
/**
|
|
6
|
+
* `vendor/ruby/v3.3.11/ext/strscan/strscan.c:1667` `rb_define_class("StringScanner", rb_cObject)`.
|
|
7
|
+
*
|
|
8
|
+
* @noRailsEquivalent PERMANENT
|
|
9
|
+
*/
|
|
10
|
+
export class StringScanner {
|
|
11
|
+
#str;
|
|
12
|
+
#curr = 0;
|
|
13
|
+
/**
|
|
14
|
+
* `vendor/ruby/v3.3.11/ext/strscan/strscan.c:233` `strscan_initialize`.
|
|
15
|
+
*
|
|
16
|
+
* @noRailsEquivalent PERMANENT
|
|
17
|
+
*/
|
|
18
|
+
constructor(str) {
|
|
19
|
+
this.#str = str;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* `vendor/ruby/v3.3.11/ext/strscan/strscan.c:357` `strscan_get_string`.
|
|
23
|
+
*
|
|
24
|
+
* @noRailsEquivalent PERMANENT
|
|
25
|
+
*/
|
|
26
|
+
get string() {
|
|
27
|
+
return this.#str;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* `vendor/ruby/v3.3.11/ext/strscan/strscan.c:372` `strscan_set_string`, which
|
|
31
|
+
* also resets the scan pointer and clears the match.
|
|
32
|
+
*
|
|
33
|
+
* @noRailsEquivalent PERMANENT
|
|
34
|
+
*/
|
|
35
|
+
set string(str) {
|
|
36
|
+
this.#str = str;
|
|
37
|
+
this.#curr = 0;
|
|
38
|
+
REGS.set(this, null);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* `vendor/ruby/v3.3.11/ext/strscan/strscan.c:314` `strscan_reset`.
|
|
42
|
+
*
|
|
43
|
+
* @noRailsEquivalent PERMANENT
|
|
44
|
+
*/
|
|
45
|
+
reset() {
|
|
46
|
+
this.#curr = 0;
|
|
47
|
+
REGS.set(this, null);
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* `vendor/ruby/v3.3.11/ext/strscan/strscan.c:423` `strscan_get_pos`.
|
|
52
|
+
*
|
|
53
|
+
* @noRailsEquivalent PERMANENT
|
|
54
|
+
*/
|
|
55
|
+
get pos() {
|
|
56
|
+
return this.#curr;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* `vendor/ruby/v3.3.11/ext/strscan/strscan.c:681` `strscan_scan`. The match
|
|
60
|
+
* runs over the rest of the string (`strscan_do_scan`, `:605`), so `^` and
|
|
61
|
+
* `\A` anchor at the scan pointer.
|
|
62
|
+
*
|
|
63
|
+
* @noRailsEquivalent PERMANENT
|
|
64
|
+
*/
|
|
65
|
+
scan(pattern) {
|
|
66
|
+
if (this.#str.length - this.#curr < 0)
|
|
67
|
+
return null;
|
|
68
|
+
let re = HEADONLY.get(pattern);
|
|
69
|
+
if (re === undefined) {
|
|
70
|
+
re = new RegExp(pattern.source, `${pattern.flags.replace(/[gy]/g, "")}y`);
|
|
71
|
+
HEADONLY.set(pattern, re);
|
|
72
|
+
}
|
|
73
|
+
re.lastIndex = 0;
|
|
74
|
+
const m = re.exec(this.#str.slice(this.#curr));
|
|
75
|
+
REGS.set(this, m);
|
|
76
|
+
if (m === null)
|
|
77
|
+
return null;
|
|
78
|
+
PREV.set(this, this.#curr);
|
|
79
|
+
this.#curr += m[0].length;
|
|
80
|
+
return m[0];
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* `vendor/ruby/v3.3.11/ext/strscan/strscan.c:884` `strscan_getch`.
|
|
84
|
+
*
|
|
85
|
+
* @noRailsEquivalent PERMANENT
|
|
86
|
+
*/
|
|
87
|
+
getch() {
|
|
88
|
+
if (this.isEos()) {
|
|
89
|
+
REGS.set(this, null);
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
return this.scan(/[\s\S]/u);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* `vendor/ruby/v3.3.11/ext/strscan/strscan.c:1000` `strscan_unscan`.
|
|
96
|
+
*
|
|
97
|
+
* @noRailsEquivalent PERMANENT
|
|
98
|
+
*/
|
|
99
|
+
unscan() {
|
|
100
|
+
if (!REGS.get(this))
|
|
101
|
+
throw new Error("unscan failed: previous match record not exist");
|
|
102
|
+
this.#curr = PREV.get(this);
|
|
103
|
+
REGS.set(this, null);
|
|
104
|
+
return this;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* `vendor/ruby/v3.3.11/ext/strscan/strscan.c:778` `strscan_scan_until`: the
|
|
108
|
+
* match is searched for over the rest of the string (`strscan_do_scan`,
|
|
109
|
+
* `:605`, with `headonly` false), and the answer runs from the old scan
|
|
110
|
+
* pointer to the end of the match.
|
|
111
|
+
*
|
|
112
|
+
* @noRailsEquivalent PERMANENT
|
|
113
|
+
*/
|
|
114
|
+
scanUntil(pattern) {
|
|
115
|
+
let re = SEARCH.get(pattern);
|
|
116
|
+
if (re === undefined) {
|
|
117
|
+
re = new RegExp(pattern.source, `${pattern.flags.replace(/[gy]/g, "")}g`);
|
|
118
|
+
SEARCH.set(pattern, re);
|
|
119
|
+
}
|
|
120
|
+
const rest = this.#str.slice(this.#curr);
|
|
121
|
+
re.lastIndex = 0;
|
|
122
|
+
const m = re.exec(rest);
|
|
123
|
+
REGS.set(this, m);
|
|
124
|
+
if (m === null)
|
|
125
|
+
return null;
|
|
126
|
+
const prev = this.#curr;
|
|
127
|
+
PREV.set(this, prev);
|
|
128
|
+
this.#curr += m.index + m[0].length;
|
|
129
|
+
return this.#str.slice(prev, this.#curr);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* `vendor/ruby/v3.3.11/ext/strscan/strscan.c:797` `strscan_exist_p`: a
|
|
133
|
+
* search over the rest of the string (`strscan_do_scan` with `succptr` and
|
|
134
|
+
* `getstr` false) that records the match but leaves the scan pointer, and
|
|
135
|
+
* answers the distance from it to the end of the match.
|
|
136
|
+
*
|
|
137
|
+
* @noRailsEquivalent PERMANENT
|
|
138
|
+
*/
|
|
139
|
+
isExist(pattern) {
|
|
140
|
+
let re = SEARCH.get(pattern);
|
|
141
|
+
if (re === undefined) {
|
|
142
|
+
re = new RegExp(pattern.source, `${pattern.flags.replace(/[gy]/g, "")}g`);
|
|
143
|
+
SEARCH.set(pattern, re);
|
|
144
|
+
}
|
|
145
|
+
re.lastIndex = 0;
|
|
146
|
+
const m = re.exec(this.#str.slice(this.#curr));
|
|
147
|
+
REGS.set(this, m);
|
|
148
|
+
if (m === null)
|
|
149
|
+
return null;
|
|
150
|
+
return m.index + m[0].length;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* `vendor/ruby/v3.3.11/ext/strscan/strscan.c:1132` `strscan_matched_size`.
|
|
154
|
+
*
|
|
155
|
+
* @noRailsEquivalent PERMANENT
|
|
156
|
+
*/
|
|
157
|
+
matchedSize() {
|
|
158
|
+
const regs = REGS.get(this) ?? null;
|
|
159
|
+
if (regs === null)
|
|
160
|
+
return null;
|
|
161
|
+
return regs[0].length;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* `vendor/ruby/v3.3.11/ext/strscan/strscan.c:1186` `strscan_aref`, `StringScanner#[]`
|
|
165
|
+
* by group number.
|
|
166
|
+
*
|
|
167
|
+
* @noRailsEquivalent PERMANENT
|
|
168
|
+
*/
|
|
169
|
+
get(idx) {
|
|
170
|
+
const regs = REGS.get(this) ?? null;
|
|
171
|
+
if (regs === null)
|
|
172
|
+
return null;
|
|
173
|
+
let i = idx;
|
|
174
|
+
if (i < 0)
|
|
175
|
+
i += regs.length;
|
|
176
|
+
if (i < 0)
|
|
177
|
+
return null;
|
|
178
|
+
if (i >= regs.length)
|
|
179
|
+
return null;
|
|
180
|
+
return regs[i] ?? null;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* `vendor/ruby/v3.3.11/ext/strscan/strscan.c:723` `strscan_skip`.
|
|
184
|
+
*
|
|
185
|
+
* @noRailsEquivalent PERMANENT
|
|
186
|
+
*/
|
|
187
|
+
skip(pattern) {
|
|
188
|
+
const matched = this.scan(pattern);
|
|
189
|
+
return matched === null ? null : matched.length;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* `vendor/ruby/v3.3.11/ext/strscan/strscan.c:962` `strscan_peek`.
|
|
193
|
+
*
|
|
194
|
+
* @noRailsEquivalent PERMANENT
|
|
195
|
+
*/
|
|
196
|
+
peek(len) {
|
|
197
|
+
return this.#str.slice(this.#curr, this.#curr + len);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* `vendor/ruby/v3.3.11/ext/strscan/strscan.c:1046` `strscan_eos_p`.
|
|
201
|
+
*
|
|
202
|
+
* @noRailsEquivalent PERMANENT
|
|
203
|
+
*/
|
|
204
|
+
isEos() {
|
|
205
|
+
return this.#curr >= this.#str.length;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* `vendor/ruby/v3.3.11/ext/strscan/strscan.c:332` `strscan_terminate`.
|
|
209
|
+
*
|
|
210
|
+
* @noRailsEquivalent PERMANENT
|
|
211
|
+
*/
|
|
212
|
+
terminate() {
|
|
213
|
+
this.#curr = this.#str.length;
|
|
214
|
+
REGS.set(this, null);
|
|
215
|
+
return this;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* `vendor/ruby/v3.3.11/ext/strscan/strscan.c:1109` `strscan_matched`.
|
|
219
|
+
*
|
|
220
|
+
* @noRailsEquivalent PERMANENT
|
|
221
|
+
*/
|
|
222
|
+
matched() {
|
|
223
|
+
const regs = REGS.get(this) ?? null;
|
|
224
|
+
if (regs === null)
|
|
225
|
+
return null;
|
|
226
|
+
return regs[0];
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* `vendor/ruby/v3.3.11/ext/strscan/strscan.c:1320` `strscan_pre_match`.
|
|
230
|
+
*
|
|
231
|
+
* @noRailsEquivalent PERMANENT
|
|
232
|
+
*/
|
|
233
|
+
preMatch() {
|
|
234
|
+
const regs = REGS.get(this) ?? null;
|
|
235
|
+
if (regs === null)
|
|
236
|
+
return null;
|
|
237
|
+
return this.#str.slice(0, this.#curr - regs[0].length);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* `vendor/ruby/v3.3.11/ext/strscan/strscan.c:1357` `strscan_rest`.
|
|
241
|
+
*
|
|
242
|
+
* @noRailsEquivalent PERMANENT
|
|
243
|
+
*/
|
|
244
|
+
rest() {
|
|
245
|
+
return this.#str.slice(this.#curr);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=string-scanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-scanner.js","sourceRoot":"","sources":["../lib/string-scanner.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAkB,CAAC;AAC/C,MAAM,MAAM,GAAG,IAAI,OAAO,EAAkB,CAAC;AAC7C,MAAM,IAAI,GAAG,IAAI,OAAO,EAAyC,CAAC;AAClE,MAAM,IAAI,GAAG,IAAI,OAAO,EAAyB,CAAC;AAElD;;;;GAIG;AACH,MAAM,OAAO,aAAa;IACxB,IAAI,CAAS;IACb,KAAK,GAAG,CAAC,CAAC;IAEV;;;;OAIG;IACH,YAAY,GAAW;QACrB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,CAAC;IAED;;;;OAIG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACH,IAAI,MAAM,CAAC,GAAW;QACpB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACH,KAAK;QACH,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;;;;;OAMG;IACH,IAAI,CAAC,OAAe;QAClB,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QACnD,IAAI,EAAE,GAAG,QAAQ,CAAC,GAAG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ACF,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;CACF"}
|
package/dist/struct.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An instance of a class built by `Struct.new` (`vendor/ruby/v3.3.11/struct.c:643`
|
|
3
|
+
* `rb_struct_s_def`): the `RSTRUCT` whose members `rb_struct_equal`,
|
|
4
|
+
* `rb_struct_eql` and `rb_struct_hash` walk.
|
|
5
|
+
*
|
|
6
|
+
* @noRailsEquivalent PERMANENT
|
|
7
|
+
*/
|
|
8
|
+
export interface StructInstance {
|
|
9
|
+
members(): string[];
|
|
10
|
+
initializeCopy(s: StructInstance): this;
|
|
11
|
+
equals(other: unknown): boolean;
|
|
12
|
+
eql(other: unknown): boolean;
|
|
13
|
+
hash(): number;
|
|
14
|
+
toA(): unknown[];
|
|
15
|
+
toH(block?: (k: string, v: unknown) => [unknown, unknown]): Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* `RB_TYPE_P(s2, T_STRUCT)` (`vendor/ruby/v3.3.11/struct.c:1403`).
|
|
19
|
+
*
|
|
20
|
+
* @noRailsEquivalent PERMANENT
|
|
21
|
+
*/
|
|
22
|
+
export declare function isStruct(value: unknown): value is StructInstance & object;
|
|
23
|
+
/**
|
|
24
|
+
* `RSTRUCT_GET` (`vendor/ruby/v3.3.11/internal/struct.h:115`): the value in
|
|
25
|
+
* slot `k`, read past any reader the class overrides.
|
|
26
|
+
*
|
|
27
|
+
* @noRailsEquivalent PERMANENT
|
|
28
|
+
*/
|
|
29
|
+
export declare function rstructGet(st: StructInstance, k: number): unknown;
|
|
30
|
+
/**
|
|
31
|
+
* `rb_struct_initialize` (`vendor/ruby/v3.3.11/struct.c:795`), over
|
|
32
|
+
* `rb_struct_initialize_m` (`struct.c:742`).
|
|
33
|
+
*
|
|
34
|
+
* @noRailsEquivalent PERMANENT
|
|
35
|
+
*/
|
|
36
|
+
export declare function rbStructInitialize(self: StructInstance, values: unknown[]): void;
|
|
37
|
+
/**
|
|
38
|
+
* Ruby's `Struct` (`vendor/ruby/v3.3.11/struct.c:2166` `rb_cStruct`). `Struct.new`
|
|
39
|
+
* returns the members' anonymous class, which `class X < Struct.new(...)`
|
|
40
|
+
* inherits from. The values live in the instance's `RSTRUCT` slot and each
|
|
41
|
+
* member is an accessor over it on the anonymous class, so a subclass reader
|
|
42
|
+
* of the same name reaches the raw slot as `super.member`.
|
|
43
|
+
*
|
|
44
|
+
* @noRailsEquivalent PERMANENT
|
|
45
|
+
*/
|
|
46
|
+
export declare const Struct: {
|
|
47
|
+
/**
|
|
48
|
+
* `rb_struct_s_def` (`vendor/ruby/v3.3.11/struct.c:643`).
|
|
49
|
+
*
|
|
50
|
+
* @noRailsEquivalent PERMANENT
|
|
51
|
+
*/
|
|
52
|
+
"new"<M extends string, T extends Record<M, unknown> = Record<M, unknown>>(...memberNames: M[]): new (...values: unknown[]) => StructInstance & T;
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=struct.d.ts.map
|
package/dist/struct.js
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { ArgumentError } from "./argument-error.js";
|
|
2
|
+
import { FrozenError } from "./frozen-error.js";
|
|
3
|
+
import { rbInspect, rbObjClassname } from "./object.js";
|
|
4
|
+
import { rbEql, rbEqual } from "./rb-equal.js";
|
|
5
|
+
import { rbHash } from "./rb-hash.js";
|
|
6
|
+
import { TypeError } from "./type-error.js";
|
|
7
|
+
const RSTRUCT = Symbol("RSTRUCT");
|
|
8
|
+
const structClasses = new WeakSet();
|
|
9
|
+
/**
|
|
10
|
+
* `RB_TYPE_P(s2, T_STRUCT)` (`vendor/ruby/v3.3.11/struct.c:1403`).
|
|
11
|
+
*
|
|
12
|
+
* @noRailsEquivalent PERMANENT
|
|
13
|
+
*/
|
|
14
|
+
export function isStruct(value) {
|
|
15
|
+
if (typeof value !== "object" || value === null)
|
|
16
|
+
return false;
|
|
17
|
+
for (let proto = Object.getPrototypeOf(value); proto; proto = Object.getPrototypeOf(proto)) {
|
|
18
|
+
if (structClasses.has(proto))
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
function structValues(s) {
|
|
24
|
+
return [...s[RSTRUCT]];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* `RSTRUCT_GET` (`vendor/ruby/v3.3.11/internal/struct.h:115`): the value in
|
|
28
|
+
* slot `k`, read past any reader the class overrides.
|
|
29
|
+
*
|
|
30
|
+
* @noRailsEquivalent PERMANENT
|
|
31
|
+
*/
|
|
32
|
+
export function rstructGet(st, k) {
|
|
33
|
+
return st[RSTRUCT][k];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* `rb_struct_initialize` (`vendor/ruby/v3.3.11/struct.c:795`), over
|
|
37
|
+
* `rb_struct_initialize_m` (`struct.c:742`).
|
|
38
|
+
*
|
|
39
|
+
* @noRailsEquivalent PERMANENT
|
|
40
|
+
*/
|
|
41
|
+
export function rbStructInitialize(self, values) {
|
|
42
|
+
const members = self.members();
|
|
43
|
+
if (members.length < values.length)
|
|
44
|
+
throw new ArgumentError("struct size differs");
|
|
45
|
+
self[RSTRUCT] = members.map((_member, i) => values[i] ?? null);
|
|
46
|
+
}
|
|
47
|
+
const pairedRecursion = [];
|
|
48
|
+
function rbExecRecursivePaired(func, s, s2) {
|
|
49
|
+
if (pairedRecursion.some(([obj, paired]) => obj === s && paired === s2)) {
|
|
50
|
+
return func(s, s2, true);
|
|
51
|
+
}
|
|
52
|
+
pairedRecursion.push([s, s2]);
|
|
53
|
+
try {
|
|
54
|
+
return func(s, s2, false);
|
|
55
|
+
}
|
|
56
|
+
finally {
|
|
57
|
+
pairedRecursion.pop();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function recursiveEqual(s, s2, recur) {
|
|
61
|
+
if (recur)
|
|
62
|
+
return true;
|
|
63
|
+
const values = structValues(s2);
|
|
64
|
+
return structValues(s).every((value, i) => rbEqual(value, values[i]));
|
|
65
|
+
}
|
|
66
|
+
function recursiveEql(s, s2, recur) {
|
|
67
|
+
if (recur)
|
|
68
|
+
return true;
|
|
69
|
+
const values = structValues(s2);
|
|
70
|
+
return structValues(s).every((value, i) => rbEql(value, values[i]));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Ruby's `Struct` (`vendor/ruby/v3.3.11/struct.c:2166` `rb_cStruct`). `Struct.new`
|
|
74
|
+
* returns the members' anonymous class, which `class X < Struct.new(...)`
|
|
75
|
+
* inherits from. The values live in the instance's `RSTRUCT` slot and each
|
|
76
|
+
* member is an accessor over it on the anonymous class, so a subclass reader
|
|
77
|
+
* of the same name reaches the raw slot as `super.member`.
|
|
78
|
+
*
|
|
79
|
+
* @noRailsEquivalent PERMANENT
|
|
80
|
+
*/
|
|
81
|
+
export const Struct = {
|
|
82
|
+
/**
|
|
83
|
+
* `rb_struct_s_def` (`vendor/ruby/v3.3.11/struct.c:643`).
|
|
84
|
+
*
|
|
85
|
+
* @noRailsEquivalent PERMANENT
|
|
86
|
+
*/
|
|
87
|
+
new(...memberNames) {
|
|
88
|
+
const klass = class {
|
|
89
|
+
[RSTRUCT];
|
|
90
|
+
/**
|
|
91
|
+
* `struct_alloc` (`vendor/ruby/v3.3.11/struct.c:810`): every member starts `nil`.
|
|
92
|
+
*
|
|
93
|
+
* @noRailsEquivalent PERMANENT
|
|
94
|
+
*/
|
|
95
|
+
static allocate() {
|
|
96
|
+
const st = Object.create(this.prototype);
|
|
97
|
+
rbStructInitialize(st, []);
|
|
98
|
+
return st;
|
|
99
|
+
}
|
|
100
|
+
/** `rb_struct_initialize_m` (`vendor/ruby/v3.3.11/struct.c:742`). */
|
|
101
|
+
constructor(...values) {
|
|
102
|
+
rbStructInitialize(this, values);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* `rb_struct_members_m` (`vendor/ruby/v3.3.11/struct.c:227`).
|
|
106
|
+
*
|
|
107
|
+
* @noRailsEquivalent PERMANENT
|
|
108
|
+
*/
|
|
109
|
+
members() {
|
|
110
|
+
return [...memberNames];
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* `rb_struct_init_copy` (`vendor/ruby/v3.3.11/struct.c:1123`), whose
|
|
114
|
+
* `OBJ_INIT_COPY` is `rb_obj_init_copy` (`vendor/ruby/v3.3.11/object.c:634`).
|
|
115
|
+
*
|
|
116
|
+
* @noRailsEquivalent PERMANENT
|
|
117
|
+
*/
|
|
118
|
+
initializeCopy(s) {
|
|
119
|
+
if (this === s)
|
|
120
|
+
return this;
|
|
121
|
+
if (Object.isFrozen(this)) {
|
|
122
|
+
throw new FrozenError(`can't modify frozen ${rbObjClassname(this)}: ${rbInspect(this)}`, {
|
|
123
|
+
receiver: this,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
if (this.constructor !== s.constructor) {
|
|
127
|
+
throw new TypeError("initialize_copy should take same class object");
|
|
128
|
+
}
|
|
129
|
+
if (this.members().length !== s.members().length) {
|
|
130
|
+
throw new TypeError("struct size mismatch");
|
|
131
|
+
}
|
|
132
|
+
this[RSTRUCT] = structValues(s);
|
|
133
|
+
return this;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* `rb_struct_equal` (`vendor/ruby/v3.3.11/struct.c:1400`).
|
|
137
|
+
*
|
|
138
|
+
* @noRailsEquivalent PERMANENT
|
|
139
|
+
*/
|
|
140
|
+
equals(other) {
|
|
141
|
+
if (this === other)
|
|
142
|
+
return true;
|
|
143
|
+
if (!isStruct(other))
|
|
144
|
+
return false;
|
|
145
|
+
if (this.constructor !== other.constructor)
|
|
146
|
+
return false;
|
|
147
|
+
return rbExecRecursivePaired(recursiveEqual, this, other);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* `rb_struct_eql` (`vendor/ruby/v3.3.11/struct.c:1481`).
|
|
151
|
+
*
|
|
152
|
+
* @noRailsEquivalent PERMANENT
|
|
153
|
+
*/
|
|
154
|
+
eql(other) {
|
|
155
|
+
if (this === other)
|
|
156
|
+
return true;
|
|
157
|
+
if (!isStruct(other))
|
|
158
|
+
return false;
|
|
159
|
+
if (this.constructor !== other.constructor)
|
|
160
|
+
return false;
|
|
161
|
+
return rbExecRecursivePaired(recursiveEql, this, other);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* `rb_struct_hash` (`vendor/ruby/v3.3.11/struct.c:1432`).
|
|
165
|
+
*
|
|
166
|
+
* @noRailsEquivalent PERMANENT
|
|
167
|
+
*/
|
|
168
|
+
hash() {
|
|
169
|
+
return rbHash([this.constructor, ...structValues(this)]);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* `rb_struct_to_a` (`vendor/ruby/v3.3.11/struct.c:1028`).
|
|
173
|
+
*
|
|
174
|
+
* @noRailsEquivalent PERMANENT
|
|
175
|
+
*/
|
|
176
|
+
toA() {
|
|
177
|
+
return [...this[RSTRUCT]];
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* `rb_struct_to_h` (`vendor/ruby/v3.3.11/struct.c:1057`).
|
|
181
|
+
*
|
|
182
|
+
* @noRailsEquivalent PERMANENT
|
|
183
|
+
*/
|
|
184
|
+
toH(block) {
|
|
185
|
+
const h = {};
|
|
186
|
+
const members = this.members();
|
|
187
|
+
for (let i = 0; i < this[RSTRUCT].length; i++) {
|
|
188
|
+
const k = members[i];
|
|
189
|
+
const v = this[RSTRUCT][i];
|
|
190
|
+
if (block) {
|
|
191
|
+
const pair = block(k, v);
|
|
192
|
+
h[pair[0]] = pair[1];
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
h[k] = v;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return h;
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
memberNames.forEach((member, i) => {
|
|
202
|
+
Object.defineProperty(klass.prototype, member, {
|
|
203
|
+
/** `define_aref_method` (`vendor/ruby/v3.3.11/struct.c:283`). */
|
|
204
|
+
get() {
|
|
205
|
+
return this[RSTRUCT][i];
|
|
206
|
+
},
|
|
207
|
+
/** `define_aset_method` (`vendor/ruby/v3.3.11/struct.c:289`), behind `rb_struct_modify` (`:246`). */
|
|
208
|
+
set(val) {
|
|
209
|
+
if (Object.isFrozen(this)) {
|
|
210
|
+
throw new FrozenError(`can't modify frozen ${rbObjClassname(this)}: ${rbInspect(this)}`, { receiver: this });
|
|
211
|
+
}
|
|
212
|
+
this[RSTRUCT][i] = val;
|
|
213
|
+
},
|
|
214
|
+
configurable: true,
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
structClasses.add(klass.prototype);
|
|
218
|
+
Object.defineProperty(klass, "name", { value: "" });
|
|
219
|
+
return klass;
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
//# sourceMappingURL=struct.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"struct.js","sourceRoot":"","sources":["../lib/struct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAmB5C,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAElC,MAAM,aAAa,GAAG,IAAI,OAAO,EAAU,CAAC;AAE5C;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CA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C,CAAC;oBACX,CAAC;gBACH,CAAC;gBACD,OAAO,CAAC,CAAC;YACX,CAAC;SACF,CAAC;QACF,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAChC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE;gBAC7C,iEAAiE;gBACjE,GAAG;oBACD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC1B,CAAC;gBACD,qGAAqG;gBACrG,GAAG,CAAmC,GAAY;oBAChD,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;wBAC1B,MAAM,IAAI,WAAW,CACnB,uBAAuB,cAAc,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC,IAAI,CAAC,EAAE,EACjE,EAAE,QAAQ,EAAE,IAAI,EAAE,CACnB,CAAC;oBACJ,CAAC;oBACD,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;gBACzB,CAAC;gBACD,YAAY,EAAE,IAAI;aACnB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACnC,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;QACpD,OAAO,KAAoE,CAAC;IAC9E,CAAC;CACF,CAAC"}
|
package/dist/symbol.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ruby's `Symbol` (`vendor/ruby/v3.3.11/symbol.c`) as trails spells it: a JS string
|
|
3
|
+
* that KEEPS its leading colon (`":short"`). A JS `Symbol` is reserved for
|
|
4
|
+
* private keys and brands, so the colon is what carries the discriminator Ruby
|
|
5
|
+
* gets from the type — and it is how the value already renders through
|
|
6
|
+
* `Symbol#inspect` (`vendor/ruby/v3.3.11/string.c:11692` `sym_inspect`, which writes
|
|
7
|
+
* the colon back in front of the name).
|
|
8
|
+
*
|
|
9
|
+
* Three members, because three questions are asked of the convention across
|
|
10
|
+
* the tree: is this value a Symbol, what is its name, and which Ruby method
|
|
11
|
+
* name a trails member name spells.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Ruby `Symbol === x` — the type test a `case`/`when Symbol` makes
|
|
15
|
+
* (`vendor/ruby/v3.3.11/symbol.c:954` `rb_sym2str` is what answers for one), spelled
|
|
16
|
+
* against the colon convention above.
|
|
17
|
+
*
|
|
18
|
+
* Call sites: `i18n/lib/backend/base.ts`, `backend/fallbacks.ts`,
|
|
19
|
+
* `backend/simple.ts`, `backend/key-value.ts`,
|
|
20
|
+
* `activemodel/lib/validations/numericality.ts`.
|
|
21
|
+
*
|
|
22
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Symbol`, which Rails inherits
|
|
23
|
+
* rather than defines.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isSymbol(value: unknown): value is string;
|
|
26
|
+
/**
|
|
27
|
+
* Ruby `Symbol#to_s` / `Symbol#name` — `vendor/ruby/v3.3.11/symbol.c:954` `rb_sym2str`,
|
|
28
|
+
* the frozen string representation NOT including the leading colon.
|
|
29
|
+
*
|
|
30
|
+
* Call sites: `i18n/lib/backend/base.ts`'s `toS` and its `t()` key
|
|
31
|
+
* interpolation.
|
|
32
|
+
*
|
|
33
|
+
* @noRailsEquivalent PERMANENT — Ruby core `Symbol#to_s`, which Rails inherits
|
|
34
|
+
* rather than defines.
|
|
35
|
+
*/
|
|
36
|
+
export declare function symbolToS(sym: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* `String#to_sym` (`vendor/ruby/v3.3.11/symbol.c:862` `rb_str_intern`): the
|
|
39
|
+
* Symbol is the string with its leading colon.
|
|
40
|
+
*
|
|
41
|
+
* @noRailsEquivalent PERMANENT
|
|
42
|
+
*/
|
|
43
|
+
export declare function stringToSym(value: string): string;
|
|
44
|
+
/** @noRailsEquivalent PERMANENT */
|
|
45
|
+
export declare const PLURAL_PREDICATE_ALIAS_ROWS: ReadonlyArray<readonly [string, string]>;
|
|
46
|
+
/** @noRailsEquivalent PERMANENT */
|
|
47
|
+
export declare function rbMethodName(name: string): string;
|
|
48
|
+
//# sourceMappingURL=symbol.d.ts.map
|