diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-02-21 01:02:41 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-02-21 01:02:41 +0000 |
commit | 6673f4e8afb9d468849bcc7d87c82c46c799f119 (patch) | |
tree | 18cc40375e35f132894992ca6f2c99e38aafe8b0 /ext/psych/lib/psych/json | |
parent | 39160bd46dfc3207429b256c6fa41838668259d6 (diff) |
* 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
Diffstat (limited to 'ext/psych/lib/psych/json')
-rw-r--r-- | ext/psych/lib/psych/json/stream.rb | 11 |
1 files changed, 10 insertions, 1 deletions
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 |