YAML event parser class. This class parses a YAML document and calls events on the handler that is passed to the constructor. The events can be used for things such as constructing a YAML AST or deserializing YAML documents. It can even be fed back to Psych::Emitter to emit the same document that was parsed.
Here is an example that prints out ever scalar found in a YAML document:
# Handler for detecting scalar values class ScalarHandler < Psych::Handler def scalar value, anchor, tag, plain, quoted, style puts value end end parser = Psych::Parser.new(ScalarHandler.new) parser.parse(yaml_document)
ANY = Any encoding
UTF8 = INT2NUM(YAML_UTF8_ENCODING)
UTF16LE = INT2NUM(YAML_UTF16LE_ENCODING)
UTF16BE = INT2NUM(YAML_UTF16BE_ENCODING)
The handler on which events will be called