Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. 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.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0