Extended maintenance of Ruby 1.9.3 ended on February 23, 2015. Read more

In Files

  • psych/lib/psych/nodes/document.rb



This represents a YAML Document. This node must be a child of Psych::Nodes::Stream. A Psych::Nodes::Document must have one child, and that child may be one of the following:



Was this document implicitly created?


Is the end of the document implicit?


A list of tag directives for this document


The version of the YAML document

Public Class Methods

new(version = [], tag_directives = [], implicit = false) click to toggle source

Create a new Psych::Nodes::Document object.

version is a list indicating the YAML version. tags_directives is a list of tag directive declarations implicit is a flag indicating whether the document will be implicitly started.


This creates a YAML document object that represents a YAML 1.1 document with one tag directive, and has an implicit start:

  [["!", "tag:tenderlovemaking.com,2009:"]],

See Also

See also Psych::Handler#start_document

               # File psych/lib/psych/nodes/document.rb, line 44
def initialize version = [], tag_directives = [], implicit = false
  @version        = version
  @tag_directives = tag_directives
  @implicit       = implicit
  @implicit_end   = true

Public Instance Methods

root() click to toggle source

Returns the root node. A Document may only have one root node: yaml.org/spec/1.1/#id898031

               # File psych/lib/psych/nodes/document.rb, line 55
def root

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus