Configuration object defining the token structure for parsing.
+
+
A Config describes what tokens look like: their opening/closing delimiters,
+segment separators, and segment count constraints. Configs are frozen after
+initialization and implement #hash/#eql? for grammar caching.
A token consists of segments separated by configured separators,
+wrapped in pre/post delimiters. For example, with default config,
+{KJ|GEM_NAME} has segments ["KJ", "GEM_NAME"].
Resolves tokens in a parsed Document using a replacement map.
+
+
Text nodes pass through unchanged. Token nodes are looked up in the
+replacement map by their key. Missing tokens are handled according
+to the on_missing policy.
# File 'lib/token/resolver/resolve.rb', line 53
+
+defresolve(document_or_nodes,replacements)
+ nodes=casedocument_or_nodes
+ whenDocument
+ document_or_nodes.nodes
+ whenArray
+ document_or_nodes
+ else
+ raiseArgumentError,"Expected Document or Array of nodes, got #{document_or_nodes.class}"
+ end
+
+ result=+""
+ nodes.eachdo|node|
+ ifnode.token?
+ replacement=replacements[node.key]
+ ifreplacement
+ result<<replacement
+ else
+ handle_missing(node,result)
+ end
+ else
+ result<<node.to_s
+ end
+ end
+ result
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/Token/Resolver/Transform.html b/docs/Token/Resolver/Transform.html
index 8d3eb55..b25eb2c 100644
--- a/docs/Token/Resolver/Transform.html
+++ b/docs/Token/Resolver/Transform.html
@@ -279,7 +279,7 @@
token-resolver is a standalone Ruby gem that provides configurable PEG-based (parslet) token
-parsing and resolution. It detects structured tokens like {KJ|GEM_NAME} in arbitrary text
-and resolves them against a replacement map.
-
-
This is NOT a *-merge family gem. It depends only on parslet and version_gem.
-It has no dependency on ast-merge, tree_haver, or any merge infrastructure.
-
-
Directory Structure
-
-
lib/token/resolver/
-├── config.rb — Config value object (token structure definition)
-├── document.rb — Public API: parses input, exposes nodes
-├── grammar.rb — Dynamically builds Parslet::Parser from Config
-├── node.rb — Autoloads for Node namespace
-├── node/
-│ ├── text.rb — Plain text node
-│ └── token.rb — Token node with segments
-├── resolve.rb — Replaces tokens with values from a map
-├── transform.rb — Converts parslet output to node objects
-└── version.rb — Version information
-
-
-
Key Design Decisions
-
-
-
-Grammar never fails — Any input is valid. Unrecognized content becomes text nodes.
-
-Single-pass resolution — Replacement values are NOT re-scanned for tokens.
-
-Config is frozen and hashable — Grammar classes are cached per config.
-
-Fast-path — If input doesn’t contain the pre delimiter, no parslet invocation.
-
-
-
Running Tests
-
-
bundle exec rspec
-
-
-
Critical AI Agent Terminal Limitations
-
-
IMPORTANT: AI agents (Copilot, etc.) almost never can see terminal output from run_in_terminal.
-
-
Workarounds:
-
-
-ALWAYS redirect output to a file in the project’s local tmp/ directory, then read it back:
-
bundle exec rspec 2>&1 > tmp/rspec-output.txt
-
-
Then use read_file tool on tmp/rspec-output.txt.
-
-
-
NEVER chain cd with other commands via && — direnv won’t initialize until after
-all commands finish. Run cd alone first, then run subsequent commands separately.
-
-
-
NEVER use head, tail, or any output truncation with test commands.
-
-
-Use internal tools (grep_search, read_file, list_dir) instead of terminal for
-information gathering whenever possible.
-
-
-
API Conventions
-
-
-
All constructors accept **options for forward compatibility where appropriate
-
-
\ No newline at end of file
diff --git a/docs/file.CHANGELOG.html b/docs/file.CHANGELOG.html
index d64bef4..ae5dc2d 100644
--- a/docs/file.CHANGELOG.html
+++ b/docs/file.CHANGELOG.html
@@ -68,7 +68,7 @@
and yes, platform and engine support are part of the public API.
Please file a bug if you notice a violation of semantic versioning.
-
cff-version: 1.2.0
+title: token-resolver
+message: >-
+ If you use this work and you want to cite it,
+ then you can use the metadata from this file.
+type: software
+authors:
+
+
\ No newline at end of file
diff --git a/docs/file.CODE_OF_CONDUCT.html b/docs/file.CODE_OF_CONDUCT.html
index 65d3934..9996809 100644
--- a/docs/file.CODE_OF_CONDUCT.html
+++ b/docs/file.CODE_OF_CONDUCT.html
@@ -191,7 +191,7 @@
Many paths lead to being a sponsor or a backer of this project. Are you on such a path?
+
+
+
+
+
+
+
+
🤑 A request for help
+
+
Maintainers have teeth and need to pay their dentists.
+After getting laid off in an RIF in March, and encountering difficulty finding a new one,
+I began spending most of my time building open source tools.
+I’m hoping to be able to pay for my kids’ health insurance this month,
+so if you value the work I am doing, I need your support.
+Please consider sponsoring me or the project.
+
+
To join the community or get help 👇️ Join the Discord.
+
+
+
+
To say “thanks!” ☝️ Join the Discord or 👇️ send money.
+
+
💌 💌 💌
+
+
Another Way to Support Open Source Software
+
+
I’m driven by a passion to foster a thriving open-source community – a space where people can tackle complex problems, no matter how small. Revitalizing libraries that have fallen into disrepair, and building new libraries focused on solving real-world challenges, are my passions. I was recently affected by layoffs, and the tech jobs market is unwelcoming. I’m reaching out here because your support would significantly aid my efforts to provide for my family, and my farm (11 🐔 chickens, 2 🐶 dogs, 3 🐰 rabbits, 8 🐈 cats).
+
+
If you work at a company that uses my work, please encourage them to support me as a corporate sponsor. My work on gems you use might show up in bundle fund.
+
+
I’m developing a new library, floss_funding, designed to empower open-source developers like myself to get paid for the work we do, in a sustainable way. Please give it a look.
+
+
Floss-Funding.dev: 👉️ No network calls. 👉️ No tracking. 👉️ No oversight. 👉️ Minimal crypto hashing. 💡 Easily disabled nags
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/file.README.html b/docs/file.README.html
index e69de29..f61a1b2 100644
--- a/docs/file.README.html
+++ b/docs/file.README.html
@@ -0,0 +1,673 @@
+
+
+
+
+
+
+ File: README
+
+ — Documentation by YARD 0.9.38
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
if ci_badges.map(&:color).all? { it == "green"} 👇️ send money so I can do more of this. FLOSS maintenance is now my full-time job.
+
+
+
+
+ 👣 How will this project approach the September 2025 hostile takeover of RubyGems? 🚑️
+
+I've summarized my thoughts in [this blog post](https://dev.to/galtzo/hostile-takeover-of-rubygems-my-thoughts-5hlo).
+
+
+
+
🌻 Synopsis
+
+
Token::Resolver is a configurable PEG-based token parser and resolver for structured token detection and replacement in arbitrary text.
+
+
Detects structured tokens like {KJ|GEM_NAME} in any file format and resolves them against a replacement map. The token structure (delimiters, separators, segment count) is fully configurable.
+
+
# One-liner: parse and resolve
+result = Token::Resolver.resolve(
+ "Hello {KJ|NAME}, welcome to {KJ|PROJECT}!",
+ {"KJ|NAME" => "World", "KJ|PROJECT" => "my-app"},
+)
+# => "Hello World, welcome to my-app!"
+
The maintainers of this and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use.
+
+
+
+
+
💡Subscribe for support guarantees covering all your FLOSS dependencies
💡Tidelift pays maintainers to maintain the software you depend on! 📊@Pointy Haired Boss: An enterprise support subscription is “never gonna let you down”, and supports open source maintainers
+
+
+
Alternatively:
+
+
+
+
+
+
+
+
+
+
✨ Installation
+
+
Install the gem and add to the application’s Gemfile by executing:
+
+
bundle add token-resolver
+
+
+
If bundler is not being used to manage dependencies, install the gem by executing:
+
+
gem install token-resolver
+
+
+
🔒 Secure Installation
+
+
+ For Medium or High Security Installations
+
+
This gem is cryptographically signed, and has verifiable SHA-256 and SHA-512 checksums by
+stone_checksums. Be sure the gem you install hasn’t been tampered with
+by following the instructions below.
+
+
Add my public key (if you haven’t already, expires 2045-04-29) as a trusted certificate:
The parslet grammar is designed so that any input is valid. When the parser encounters
+{ but it doesn’t start a valid token, the { is consumed as plain text. No input can
+cause a parse failure.
+
+
Single-Pass Resolution
+
+
Replacement values are emitted as-is and are not re-scanned for tokens. This prevents
+infinite loops and ensures predictable behavior when replacement values contain token-like strings.
+
+
Performance
+
+
If the input doesn’t contain the pre delimiter at all, the parser fast-paths and returns
+a single Text node without invoking parslet.
+
+
🦷 FLOSS Funding
+
+
While kettle-rb tools are free software and will always be, the project would benefit immensely from some funding.
+Raising a monthly budget of… “dollars” would make the project more sustainable.
+
+
We welcome both individual and corporate sponsors! We also offer a
+wide array of funding channels to account for your preferences
+(although currently Open Collective is our preferred funding platform).
+
+
If you’re working in a company that’s making significant use of kettle-rb tools we’d
+appreciate it if you suggest to your company to become a kettle-rb sponsor.
If doing a sponsorship in the form of donation is problematic for your company from an accounting standpoint, we’d recommend the use of Tidelift, where you can get a support-like subscription instead.
+
+
+
+
+
Open Collective for Individuals
+
+
Support us with a monthly donation and help us continue our activities. [Become a backer]
I’m driven by a passion to foster a thriving open-source community – a space where people can tackle complex problems, no matter how small. Revitalizing libraries that have fallen into disrepair, and building new libraries focused on solving real-world challenges, are my passions. I was recently affected by layoffs, and the tech jobs market is unwelcoming. I’m reaching out here because your support would significantly aid my efforts to provide for my family, and my farm (11 🐔 chickens, 2 🐶 dogs, 3 🐰 rabbits, 8 🐈 cats).
+
+
If you work at a company that uses my work, please encourage them to support me as a corporate sponsor. My work on gems you use might show up in bundle fund.
+
+
I’m developing a new library, floss_funding, designed to empower open-source developers like myself to get paid for the work we do, in a sustainable way. Please give it a look.
+
+
Floss-Funding.dev: 👉️ No network calls. 👉️ No tracking. 👉️ No oversight. 👉️ Minimal crypto hashing. 💡 Easily disabled nags
+
+
+
+
🔐 Security
+
+
See {file:SECURITY.md SECURITY.md}.
+
+
🤝 Contributing
+
+
If you need some ideas of where to help, you could work on adding more code coverage,
+or if it is already 💯 (see below) check {file:REEK reek}, issues, or PRs,
+or use the gem and think about how it could be better.
+
+
We so if you make changes, remember to update it.
+
+
See {file:CONTRIBUTING.md CONTRIBUTING.md} for more detailed instructions.
+
+
🚀 Release Instructions
+
+
See {file:CONTRIBUTING.md CONTRIBUTING.md}.
+
+
Code Coverage
+
+
+
+
+
+
+
+
🪇 Code of Conduct
+
+
Everyone interacting with this project’s codebases, issue trackers,
+chat rooms and mailing lists agrees to follow the {file:CODE_OF_CONDUCT.md }.
This Library adheres to .
+Violations of this scheme should be reported as bugs.
+Specifically, if a minor or patch version is released that breaks backward compatibility,
+a new version should be immediately released that restores compatibility.
+Breaking changes to the public API will only be introduced with new major versions.
+
+
+
dropping support for a platform is both obviously and objectively a breaking change
I understand that policy doesn’t work universally (“exceptions to every rule!”),
+but it is the policy here.
+As such, in many cases it is good to specify a dependency on this library using
+the Pessimistic Version Constraint with two digits of precision.
+
+
For example:
+
+
spec.add_dependency("token-resolver", "~> 1.0")
+
+
+
+ 📌 Is "Platform Support" part of the public API? More details inside.
+
+
SemVer should, IMO, but doesn’t explicitly, say that dropping support for specific Platforms
+is a breaking change to an API, and for that reason the bike shedding is endless.
+
+
To get a better understanding of how SemVer is intended to work over a project’s lifetime,
+read this article from the creator of SemVer:
See {file:CHANGELOG.md CHANGELOG.md} for a list of releases.
+
+
📄 License
+
+
The gem is available as open source under the terms of
+the {file:LICENSE.txt MIT License} .
+See {file:LICENSE.txt LICENSE.txt} for the official Copyright Notice.
+ Copyright (c) 2026 Peter H. Boling, of
+
+ Galtzo.com
+
+
+
+ , and token-resolver contributors.
+
+
+
+
🤑 A request for help
+
+
Maintainers have teeth and need to pay their dentists.
+After getting laid off in an RIF in March, and encountering difficulty finding a new one,
+I began spending most of my time building open source tools.
+I’m hoping to be able to pay for my kids’ health insurance this month,
+so if you value the work I am doing, I need your support.
+Please consider sponsoring me or the project.
+
+
To join the community or get help 👇️ Join the Discord.
+
+
+
+
To say “thanks!” ☝️ Join the Discord or 👇️ send money.
+
+
💌 💌 💌
+
+
Please give the project a star ⭐ ♥.
+
+
Thanks for RTFM. ☺️
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/file.REEK.html b/docs/file.REEK.html
index 010f6de..e69de29 100644
--- a/docs/file.REEK.html
+++ b/docs/file.REEK.html
@@ -1,71 +0,0 @@
-
-
-
-
-
-
- File: REEK
-
- — Documentation by YARD 0.9.38
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/docs/file.SECURITY.html b/docs/file.SECURITY.html
index 3de7cac..2637481 100644
--- a/docs/file.SECURITY.html
+++ b/docs/file.SECURITY.html
@@ -91,7 +91,7 @@
if ci_badges.map(&:color).all? { it == "green"} 👇️ send money so I can do more of this. FLOSS maintenance is now my full-time job.
+
+
+
+
+ 👣 How will this project approach the September 2025 hostile takeover of RubyGems? 🚑️
+
+I've summarized my thoughts in [this blog post](https://dev.to/galtzo/hostile-takeover-of-rubygems-my-thoughts-5hlo).
+
+
+
+
🌻 Synopsis
+
+
Token::Resolver is a configurable PEG-based token parser and resolver for structured token detection and replacement in arbitrary text.
+
+
Detects structured tokens like {KJ|GEM_NAME} in any file format and resolves them against a replacement map. The token structure (delimiters, separators, segment count) is fully configurable.
+
+
# One-liner: parse and resolve
+result = Token::Resolver.resolve(
+ "Hello {KJ|NAME}, welcome to {KJ|PROJECT}!",
+ {"KJ|NAME" => "World", "KJ|PROJECT" => "my-app"},
+)
+# => "Hello World, welcome to my-app!"
+
The maintainers of this and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use.
+
+
+
+
+
💡Subscribe for support guarantees covering all your FLOSS dependencies
💡Tidelift pays maintainers to maintain the software you depend on! 📊@Pointy Haired Boss: An enterprise support subscription is “never gonna let you down”, and supports open source maintainers
+
+
+
Alternatively:
+
+
+
+
+
+
+
+
+
+
✨ Installation
+
+
Install the gem and add to the application’s Gemfile by executing:
+
+
bundle add token-resolver
+
+
+
If bundler is not being used to manage dependencies, install the gem by executing:
+
+
gem install token-resolver
+
+
+
🔒 Secure Installation
+
+
+ For Medium or High Security Installations
+
+
This gem is cryptographically signed, and has verifiable SHA-256 and SHA-512 checksums by
+stone_checksums. Be sure the gem you install hasn’t been tampered with
+by following the instructions below.
+
+
Add my public key (if you haven’t already, expires 2045-04-29) as a trusted certificate:
The parslet grammar is designed so that any input is valid. When the parser encounters
+{ but it doesn’t start a valid token, the { is consumed as plain text. No input can
+cause a parse failure.
+
+
Single-Pass Resolution
+
+
Replacement values are emitted as-is and are not re-scanned for tokens. This prevents
+infinite loops and ensures predictable behavior when replacement values contain token-like strings.
+
+
Performance
+
+
If the input doesn’t contain the pre delimiter at all, the parser fast-paths and returns
+a single Text node without invoking parslet.
+
+
🦷 FLOSS Funding
+
+
While kettle-rb tools are free software and will always be, the project would benefit immensely from some funding.
+Raising a monthly budget of… “dollars” would make the project more sustainable.
+
+
We welcome both individual and corporate sponsors! We also offer a
+wide array of funding channels to account for your preferences
+(although currently Open Collective is our preferred funding platform).
+
+
If you’re working in a company that’s making significant use of kettle-rb tools we’d
+appreciate it if you suggest to your company to become a kettle-rb sponsor.
If doing a sponsorship in the form of donation is problematic for your company from an accounting standpoint, we’d recommend the use of Tidelift, where you can get a support-like subscription instead.
+
+
+
+
+
Open Collective for Individuals
+
+
Support us with a monthly donation and help us continue our activities. [Become a backer]
I’m driven by a passion to foster a thriving open-source community – a space where people can tackle complex problems, no matter how small. Revitalizing libraries that have fallen into disrepair, and building new libraries focused on solving real-world challenges, are my passions. I was recently affected by layoffs, and the tech jobs market is unwelcoming. I’m reaching out here because your support would significantly aid my efforts to provide for my family, and my farm (11 🐔 chickens, 2 🐶 dogs, 3 🐰 rabbits, 8 🐈 cats).
+
+
If you work at a company that uses my work, please encourage them to support me as a corporate sponsor. My work on gems you use might show up in bundle fund.
+
+
I’m developing a new library, floss_funding, designed to empower open-source developers like myself to get paid for the work we do, in a sustainable way. Please give it a look.
+
+
Floss-Funding.dev: 👉️ No network calls. 👉️ No tracking. 👉️ No oversight. 👉️ Minimal crypto hashing. 💡 Easily disabled nags
+
+
+
+
🔐 Security
+
+
See {file:SECURITY.md SECURITY.md}.
+
+
🤝 Contributing
+
+
If you need some ideas of where to help, you could work on adding more code coverage,
+or if it is already 💯 (see below) check {file:REEK reek}, issues, or PRs,
+or use the gem and think about how it could be better.
+
+
We so if you make changes, remember to update it.
+
+
See {file:CONTRIBUTING.md CONTRIBUTING.md} for more detailed instructions.
+
+
🚀 Release Instructions
+
+
See {file:CONTRIBUTING.md CONTRIBUTING.md}.
+
+
Code Coverage
+
+
+
+
+
+
+
+
🪇 Code of Conduct
+
+
Everyone interacting with this project’s codebases, issue trackers,
+chat rooms and mailing lists agrees to follow the {file:CODE_OF_CONDUCT.md }.
This Library adheres to .
+Violations of this scheme should be reported as bugs.
+Specifically, if a minor or patch version is released that breaks backward compatibility,
+a new version should be immediately released that restores compatibility.
+Breaking changes to the public API will only be introduced with new major versions.
+
+
+
dropping support for a platform is both obviously and objectively a breaking change
I understand that policy doesn’t work universally (“exceptions to every rule!”),
+but it is the policy here.
+As such, in many cases it is good to specify a dependency on this library using
+the Pessimistic Version Constraint with two digits of precision.
+
+
For example:
+
+
spec.add_dependency("token-resolver", "~> 1.0")
+
+
+
+ 📌 Is "Platform Support" part of the public API? More details inside.
+
+
SemVer should, IMO, but doesn’t explicitly, say that dropping support for specific Platforms
+is a breaking change to an API, and for that reason the bike shedding is endless.
+
+
To get a better understanding of how SemVer is intended to work over a project’s lifetime,
+read this article from the creator of SemVer:
See {file:CHANGELOG.md CHANGELOG.md} for a list of releases.
+
+
📄 License
+
+
The gem is available as open source under the terms of
+the {file:LICENSE.txt MIT License} .
+See {file:LICENSE.txt LICENSE.txt} for the official Copyright Notice.
+ Copyright (c) 2026 Peter H. Boling, of
+
+ Galtzo.com
+
+
+
+ , and token-resolver contributors.
+
+
+
+
🤑 A request for help
+
+
Maintainers have teeth and need to pay their dentists.
+After getting laid off in an RIF in March, and encountering difficulty finding a new one,
+I began spending most of my time building open source tools.
+I’m hoping to be able to pay for my kids’ health insurance this month,
+so if you value the work I am doing, I need your support.
+Please consider sponsoring me or the project.
+
+
To join the community or get help 👇️ Join the Discord.
+
+
+
+
To say “thanks!” ☝️ Join the Discord or 👇️ send money.
+
+
💌 💌 💌
+
+
Please give the project a star ⭐ ♥.
+
+
Thanks for RTFM. ☺️
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/method_list.html b/docs/method_list.html
index e69de29..e2ae45f 100644
--- a/docs/method_list.html
+++ b/docs/method_list.html
@@ -0,0 +1,422 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method List
+
+
+
+