Skip to content

Fix deep_instantiate to strip trailing colon from class name#131

Merged
ianks merged 2 commits into
mainfrom
fix-deep-instantiate-trailing-colon
May 15, 2026
Merged

Fix deep_instantiate to strip trailing colon from class name#131
ianks merged 2 commits into
mainfrom
fix-deep-instantiate-trailing-colon

Conversation

@ianks
Copy link
Copy Markdown
Contributor

@ianks ianks commented Apr 27, 2026

The yaml_coders.rb encode_with methods serialize drops using a hash key like "instantiate:LiquidDropClass:" (trailing colon intentional, mirrors the unquoted YAML format). When YAML dumps a key ending in :, it quotes the whole string, preserving the trailing colon. When deep_instantiate reads it back, key.sub("instantiate:", "") leaves "LiquidDropClass:" with the trailing colon intact, so ClassRegistry.instantiate can't find it and silently falls through, leaving the raw hash in the template context.

The unquoted format (instantiate:LongString:) works fine because YAML treats the final : as the mapping separator, not part of the key.

Fix: add .chomp(":") after prefix removal. It's a no-op for the unquoted form.

@ianks ianks requested a review from tobi April 27, 2026 19:15
@ianks ianks merged commit 2a7a061 into main May 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant