Class: Psych::JSON::Stream::Emitter

Inherits:
Stream::Emitter show all
Defined in:
lib/psych/json/stream.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from Stream::Emitter

#end_document, #streaming?

Methods inherited from Emitter

#alias, #canonical, #canonical=, #end_document, #end_mapping, #end_sequence, #end_stream, #indentation, #indentation=, #initialize, #start_stream

Methods inherited from Handler

#alias, #empty, #end_document, #end_mapping, #end_sequence, #end_stream, #start_stream, #streaming?

Constructor Details

This class inherits a constructor from Psych::Emitter

Instance Method Details

#scalar(value, anchor, tag, plain, quoted, style) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/psych/json/stream.rb', line 17

def scalar value, anchor, tag, plain, quoted, style
  if "tag:yaml.org,2002:null" == tag
    super('null', nil, nil, true, false, Nodes::Scalar::PLAIN)
  else
    super
  end
end

#start_document(version, tag_directives, implicit) ⇒ Object



5
6
7
# File 'lib/psych/json/stream.rb', line 5

def start_document version, tag_directives, implicit
  super(version, tag_directives, !streaming?)
end

#start_mapping(anchor, tag, implicit, style) ⇒ Object



9
10
11
# File 'lib/psych/json/stream.rb', line 9

def start_mapping anchor, tag, implicit, style
  super(anchor, tag, implicit, Nodes::Mapping::FLOW)
end

#start_sequence(anchor, tag, implicit, style) ⇒ Object



13
14
15
# File 'lib/psych/json/stream.rb', line 13

def start_sequence anchor, tag, implicit, style
  super(anchor, tag, implicit, Nodes::Sequence::FLOW)
end