1module Psych
2  module Streaming
3    ###
4    # Create a new streaming emitter.  Emitter will print to +io+.  See
5    # Psych::Stream for an example.
6    def initialize io
7      super({}, self.class.const_get(:Emitter).new(io))
8    end
9
10    ###
11    # Start streaming using +encoding+
12    def start encoding = Nodes::Stream::UTF8
13      super.tap { yield self if block_given?  }
14    ensure
15      finish if block_given?
16    end
17
18    private
19    def register target, obj
20    end
21  end
22end
23