Maintenance of Ruby 2.0.0 will end on February 24, 2016. Read more

In Files

  • psych/lib/psych/nodes/node.rb


Included Modules


The base class for any Node in a YAML parse tree. This class should never be instantiated.



The children of this node


An associated tag

Public Class Methods

new() click to toggle source

Create a new Psych::Nodes::Node

               # File psych/lib/psych/nodes/node.rb, line 18
def initialize
  @children = []

Public Instance Methods

each(&block) click to toggle source

Iterate over each node in the tree. Yields each node to block depth first.

               # File psych/lib/psych/nodes/node.rb, line 25
def each &block
  return enum_for :each unless block_given? self
to_ruby() click to toggle source

Convert this node to Ruby.

See also Psych::Visitors::ToRuby

               # File psych/lib/psych/nodes/node.rb, line 34
def to_ruby self
Also aliased as: transform
to_yaml(io = nil, options = {}) click to toggle source
Alias for: yaml
transform() click to toggle source
Alias for: to_ruby
yaml(io = nil, options = {}) click to toggle source

Convert this node to YAML.

See also Psych::Visitors::Emitter

               # File psych/lib/psych/nodes/node.rb, line 43
def yaml io = nil, options = {}
  real_io = io ||''.encode('utf-8')), options).accept self
  return real_io.string unless io
Also aliased as: to_yaml

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

blog comments powered by Disqus