class Psych::Handler

See Psych::Parser for more details
event handlers.
Psych::Handler defines all events that Psych::Parser can possibly send to
events that they can handle.
should implement a class that inherits from Psych::Handler and define
when dealing with Psych::Parser. Clients who want to use Psych::Parser
Psych::Handler is an abstract base class that defines the events used
##

def alias anchor

called with "ponies".
&ponies is the achor, *ponies is the alias. In this case, alias is

- *ponies
- first element
--- &ponies

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

=== Example

of the anchor found.
Called when an alias is found to +anchor+. +anchor+ will be the name
##
def alias anchor
end

def empty

never).
Called when an empty event happens. (Which, as far as I can tell, is
##
def empty
end

def end_document implicit

+implicit+ will be false.

...
hello world
---

+implicit+ will be true. Given this YAML:

hello world
---

Given the following YAML:

=== Example

whether or not the document has an implicit ending.
Called with the document ends. +implicit+ is a boolean value indicating
##
def end_document implicit
end

def end_mapping

Called when a map ends
##
def end_mapping
end

def end_sequence

Called when a sequence ends.
##
def end_sequence
end

def end_stream

Called when the YAML stream ends
##
def end_stream
end

def scalar value, anchor, tag, plain, quoted, style


["many\nnewlines\n", nil, nil, false, true, 4 ]
["many lines", nil, nil, true, false, 1 ]
["fun", "anchor", nil, true, false, 1 ]
["foo", nil, "!str", false, false, 3 ]
# value anchor tag plain quoted style

the parameters sent to this method in the same order:
The above YAML document contains a list with four strings. Here are

newlines
many
- |
lines
- many
- &anchor fun
- !str "foo"
---

method can be called:
Here is a YAML document that exercises most of the possible ways this

=== Example

+style+
See the constants in Psych::Nodes::Scalar for the possible values of

+style+ is an integer idicating the string style
+quoted+ is a boolean value
+plain+ is a boolean value
+tag+ is an associated tag or nil
+anchor+ is an associated anchor or nil
+value+ is the string value of the scalar

+anchor+, a +tag+, be implicitly +plain+ or implicitly +quoted+
Called when a scalar +value+ is found. The scalar may have an
##
def scalar value, anchor, tag, plain, quoted, style
end

def start_document version, tag_directives, implicit

implicit # => false
tag_directives # => [["!", "tag:tenderlovemaking.com,2009:"]]
version # => [1, 1]

The parameters for start_document must be this:

--- !squee
%TAG ! tag:tenderlovemaking.com,2009:
%YAML 1.1

Given the following YAML:

=== Example

the document is started implicitly.
and suffix of each tag, and +implicit+ is a boolean indicating whether
dealt with, +tag_directives+ is a list of tuples indicating the prefix
+version+ will be an array of integers indicating the YAML version being

+tag_directives+, if the document is +implicit+.
Called when the document starts with the declared +version+,
##
def start_document version, tag_directives, implicit
end

def start_mapping anchor, tag, implicit, style

def start_mapping anchor, tag, implicit, style
end

def start_sequence anchor, tag, implicit, style

def start_sequence anchor, tag, implicit, style
end

def start_stream encoding

See the constants in Psych::Parser for the possible values of +encoding+.

called once per stream. A stream may contain multiple documents.
Called with +encoding+ when the YAML stream starts. This method is
##
def start_stream encoding
end

def streaming?

Is this handler a streaming handler?
##
def streaming?
  false
end