123456789_123456789_123456789_123456789_123456789_

Class: Psych::Handlers::DocumentStream

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: Psych::TreeBuilder
Defined in: ext/psych/lib/psych/handlers/document_stream.rb

Constant Summary

::Psych::Handler - Inherited

EVENTS, OPTIONS

Class Method Summary

::Psych::TreeBuilder - Inherited

.new

Create a new ::Psych::TreeBuilder instance.

Instance Attribute Summary

::Psych::TreeBuilder - Inherited

#root

Returns the root node for the built tree.

::Psych::Handler - Inherited

#streaming?

Is this handler a streaming handler?

Instance Method Summary

::Psych::TreeBuilder - Inherited

#alias,
#end_document

Handles end_document events with version, tag_directives, and implicit styling.

#end_stream, #event_location, #scalar,
#start_document

Handles start_document events with version, tag_directives, and implicit styling.

#start_stream, #pop, #push, #set_end_location, #set_location, #set_start_location

::Psych::Handler - Inherited

#alias

Called when an alias is found to anchor.

#empty

Called when an empty event happens.

#end_document

Called with the document ends.

#end_mapping

Called when a map ends.

#end_sequence

Called when a sequence ends.

#end_stream

Called when the YAML stream ends.

#event_location

Called before each event with line/column information.

#scalar

Called when a scalar value is found.

#start_document

Called when the document starts with the declared version, tag_directives, if the document is implicit.

#start_mapping

Called when a map starts.

#start_sequence

Called when a sequence is started.

#start_stream

Called with encoding when the YAML stream starts.

Constructor Details

.new(&block) ⇒ DocumentStream

[ GitHub ]

  
# File 'ext/psych/lib/psych/handlers/document_stream.rb', line 7

def initialize &block
  super
  @block = block
end

Instance Method Details

#end_document(implicit_end = !streaming?)

[ GitHub ]

  
# File 'ext/psych/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)

[ GitHub ]

  
# File 'ext/psych/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