Class: Psych::Nodes::Stream

Inherits:
Node show all
Defined in:
lib/psych/nodes/stream.rb

Overview

Represents a YAML stream. This is the root node for any YAML parse tree. This node must have one or more child nodes. The only valid child node for a Psych::Nodes::Stream node is Psych::Nodes::Document.

Constant Summary collapse

ANY =

Any encoding

Psych::Parser::ANY
UTF8 =

UTF-8 encoding

Psych::Parser::UTF8
UTF16LE =

UTF-16LE encoding

Psych::Parser::UTF16LE
UTF16BE =

UTF-16BE encoding

Psych::Parser::UTF16BE

Instance Attribute Summary collapse

Attributes inherited from Node

#children, #tag

Instance Method Summary collapse

Methods inherited from Node

#each, #to_ruby, #yaml

Constructor Details

#initialize(encoding = UTF8) ⇒ Stream

Create a new Psych::Nodes::Stream node with an encoding that defaults to Psych::Nodes::Stream::UTF8.

See also Psych::Handler#start_stream



31
32
33
34
# File 'lib/psych/nodes/stream.rb', line 31

def initialize encoding = UTF8
  super()
  @encoding = encoding
end

Instance Attribute Details

#encodingObject

The encoding used for this stream



24
25
26
# File 'lib/psych/nodes/stream.rb', line 24

def encoding
  @encoding
end