Class: Psych::Handlers::DocumentStream

Inherits:
TreeBuilder show all
Defined in:
lib/psych/handlers/document_stream.rb

Overview

:nodoc:

Constant Summary

Constants inherited from Psych::Handler

Psych::Handler::EVENTS, Psych::Handler::OPTIONS

Instance Attribute Summary

Attributes inherited from TreeBuilder

#root

Instance Method Summary collapse

Methods inherited from TreeBuilder

#alias, #end_stream, #scalar, #start_stream

Methods inherited from Psych::Handler

#alias, #empty, #end_mapping, #end_sequence, #end_stream, #scalar, #start_mapping, #start_sequence, #start_stream, #streaming?

Constructor Details

#initialize(&block) ⇒ DocumentStream

Returns a new instance of DocumentStream



6
7
8
9
# File 'lib/psych/handlers/document_stream.rb', line 6

def initialize &block
  super
  @block = block
end

Instance Method Details

#end_document(implicit_end = !streaming?) ⇒ Object



16
17
18
19
# File 'lib/psych/handlers/document_stream.rb', line 16

def end_document implicit_end = !streaming?
  @last.implicit_end = implicit_end
  @block.call pop
end

#start_document(version, tag_directives, implicit) ⇒ Object



11
12
13
14
# File 'lib/psych/handlers/document_stream.rb', line 11

def start_document version, tag_directives, implicit
  n = Nodes::Document.new version, tag_directives, implicit
  push n
end