Type:
Module
Constants:
VERSION : '2.0.0'

The version is Psych you're using

LIBYAML_VERSION : Psych.libyaml_version.join '.'

The version of libyaml Psych is using

DEPRECATED : __FILE__

Overview

Psych is a YAML parser and emitter. Psych leverages libyaml [Home page: pyyaml.org/wiki/LibYAML] or [Git repo: github.com/zerotao/libyaml] for its YAML parsing and emitting capabilities. In addition to wrapping libyaml, Psych also knows how to serialize and de-serialize most Ruby objects to and from the YAML format.

I NEED TO PARSE OR EMIT YAML RIGHT NOW!

# Parse some YAML
Psych.load("--- foo") # => "foo"

# Emit some YAML
Psych.dump("foo")     # => "--- foo\n...\n"
{ :a => 'b'}.to_yaml  # => "---\n:a: b\n"

Got more time on your hands? Keep on reading!

YAML Parsing

Psych provides a range of interfaces for parsing a YAML document ranging from low level to high level, depending on your parsing needs. At the lowest level, is an event based parser. Mid level is access to the raw YAML AST, and at the highest level is the ability to unmarshal YAML to ruby objects.

Low level parsing

The lowest level parser should be used when the YAML input is already known, and the developer does not want to pay the price of building an AST or automatic detection and conversion to ruby objects. See Psych::Parser for more information on using the event based parser.

Mid level parsing

Psych provides access to an AST produced from parsing a YAML document. This tree is built using the Psych::Parser and Psych::TreeBuilder. The AST can be examined and manipulated freely. Please see ::parse_stream, Psych::Nodes, and Psych::Nodes::Node for more information on dealing with YAML syntax trees.

High level parsing

The high level YAML parser provided by Psych simply takes YAML as input and returns a Ruby data structure. For information on using the high level parser see ::load

YAML Emitting

Psych provides a range of interfaces ranging from low to high level for producing YAML documents. Very similar to the YAML parsing interfaces, Psych provides at the lowest level, an event based system, mid-level is building a YAML AST, and the highest level is converting a Ruby object straight to a YAML document.

Low level emitting

The lowest level emitter is an event based system. Events are sent to a Psych::Emitter object. That object knows how to convert the events to a YAML document. This interface should be used when document format is known in advance or speed is a concern. See Psych::Emitter for more information.

Mid level emitting

At the mid level is building an AST. This AST is exactly the same as the AST used when parsing a YAML document. Users can build an AST by hand and the AST knows how to emit itself as a YAML document. See Psych::Nodes, Psych::Nodes::Node, and Psych::TreeBuilder for more information on building a YAML AST.

High level emitting

The high level emitter has the easiest interface. Psych simply takes a Ruby data structure and converts it to a YAML document. See ::dump for more information on dumping a Ruby data structure.

This exists just to satify bugs in marshal'd gemspecs that contain a reference to YAML::PrivateType. We prune these out in Specification._load, but if we don't have the constant, Marshal blows up.

tagurize

tagurize(thing) Class Public methods

2015-04-29 19:28:44
parse_stream

parse_stream(yaml, filename = nil, &block) Class Public methods Parse a

2015-04-29 19:19:20
read_type_class

read_type_class(type, reference) Class Public methods

2015-04-29 19:25:19
load_documents

load_documents(yaml, &block) Class Public methods This method is deprecated

2015-04-29 18:53:59
dump

Psych.dump(o) â string of yamlPsych.dump(o, options) â string of yamlPsych.dump(o, io) â io object passed inPsych

2015-04-29 18:27:59
detect_implicit

detect_implicit(thing) Class Public methods

2015-04-29 18:26:03
add_ruby_type

add_ruby_type(type_tag, &block) Class Public methods

2015-04-29 18:22:40
libyaml_version

Psych.libyaml_version Class Public methods Returns the version of libyaml being

2015-04-29 18:41:29
load

load(yaml, filename = nil) Class Public methods Load yaml in to

2015-04-29 18:48:34
object_maker

object_maker(klass, hash) Class Public methods

2015-04-29 19:07:55