Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

Psych::Handler#alias

alias(anchor)

Called when an alias is found to anchor. anchor will be the name of the anchor found.

Example

Here we have an example of an array that references itself in YAML:

--- &ponies
- first element
- *ponies

&ponies is the anchor, *ponies is the alias. In this case, alias is called with “ponies”.

See also #empty #end_document also in 4.1 · 4.0 · 3.4 · 3.2 · 3.1 · 3.0