Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. 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.3 · 3.2 · 3.1