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, #event_location, #scalar, #start_stream

Methods inherited from Psych::Handler

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

Constructor Details

#initialize(&block) ⇒ DocumentStream

Returns a new instance of DocumentStream.



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

def initialize &block
  super
  @block = block
end

Instance Method Details

#end_document(implicit_end = !streaming?) ⇒ Object



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

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

#start_document(version, tag_directives, implicit) ⇒ Object



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

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