From 6673f4e8afb9d468849bcc7d87c82c46c799f119 Mon Sep 17 00:00:00 2001 From: tenderlove Date: Mon, 21 Feb 2011 01:02:41 +0000 Subject: * ext/psych/lib/psych/json/stream.rb: fix JSON stream emits to use double quotes during stream. * test/psych/json/test_stream.rb: tests to reflect changes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/psych/lib/psych/json/stream.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'ext/psych/lib/psych/json') diff --git a/ext/psych/lib/psych/json/stream.rb b/ext/psych/lib/psych/json/stream.rb index a6da584cbf..b240b6cbdb 100644 --- a/ext/psych/lib/psych/json/stream.rb +++ b/ext/psych/lib/psych/json/stream.rb @@ -23,8 +23,17 @@ module Psych end end + def visit_Time o + formatted = format_time o + @emitter.scalar formatted, nil, nil, false, true, Nodes::Scalar::DOUBLE_QUOTED + end + + def visit_DateTime o + visit_Time o.to_time + end + def visit_String o - @emitter.scalar o.to_s, nil, nil, false, true, Nodes::Scalar::ANY + @emitter.scalar o.to_s, nil, nil, false, true, Nodes::Scalar::DOUBLE_QUOTED end alias :visit_Symbol :visit_String end -- cgit v1.2.3