1module Psych
2  module Nodes
3    ###
4    # Represents a YAML stream.  This is the root node for any YAML parse
5    # tree.  This node must have one or more child nodes.  The only valid
6    # child node for a Psych::Nodes::Stream node is Psych::Nodes::Document.
7    class Stream < Psych::Nodes::Node
8
9      # Encodings supported by Psych (and libyaml)
10
11      # Any encoding
12      ANY     = Psych::Parser::ANY
13
14      # UTF-8 encoding
15      UTF8    = Psych::Parser::UTF8
16
17      # UTF-16LE encoding
18      UTF16LE = Psych::Parser::UTF16LE
19
20      # UTF-16BE encoding
21      UTF16BE = Psych::Parser::UTF16BE
22
23      # The encoding used for this stream
24      attr_accessor :encoding
25
26      ###
27      # Create a new Psych::Nodes::Stream node with an +encoding+ that
28      # defaults to Psych::Nodes::Stream::UTF8.
29      #
30      # See also Psych::Handler#start_stream
31      def initialize encoding = UTF8
32        super()
33        @encoding = encoding
34      end
35    end
36  end
37end
38