summaryrefslogtreecommitdiff
path: root/ext/psych/lib/psych/json/tree_builder.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/psych/lib/psych/json/tree_builder.rb')
-rw-r--r--ext/psych/lib/psych/json/tree_builder.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/ext/psych/lib/psych/json/tree_builder.rb b/ext/psych/lib/psych/json/tree_builder.rb
index d0a76177bf..720ede7e1e 100644
--- a/ext/psych/lib/psych/json/tree_builder.rb
+++ b/ext/psych/lib/psych/json/tree_builder.rb
@@ -5,11 +5,11 @@ module Psych
# to an instance of Psych::JSON::TreeBuilder and a JSON AST is constructed.
class TreeBuilder < Psych::TreeBuilder
def start_document version, tag_directives, implicit
- super(version, tag_directives, true)
+ super(version, tag_directives, !streaming?)
end
def end_document implicit_end = !streaming?
- super(true)
+ super(implicit_end)
end
def start_mapping anchor, tag, implicit, style
@@ -19,6 +19,14 @@ module Psych
def start_sequence anchor, tag, implicit, style
super(anchor, tag, implicit, Nodes::Sequence::FLOW)
end
+
+ 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
end
end
end