diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-19 23:05:53 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-19 23:05:53 +0000 |
commit | a17cdfdde29faa7e6c5feb1c31d41e4f42328daa (patch) | |
tree | 9abdd148b52ae4019955d386c3aabaedc5cac723 /test/psych | |
parent | 64847a9cfe467b808ca5e8148dfa85a059198963 (diff) | |
download | ruby-a17cdfdde29faa7e6c5feb1c31d41e4f42328daa.tar.gz |
* ext/psych/lib/psych/coder.rb (represent_object): arbitrary objects
may be passed to the Psych::Coder object.
* ext/psych/lib/psych/visitors/yaml_tree.rb: support for visiting
arbitrary objects set on the coder.
* test/psych/test_coder.rb: supporting test case.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/psych')
-rw-r--r-- | test/psych/test_coder.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/psych/test_coder.rb b/test/psych/test_coder.rb index c171c5ad0d..4809b13d5d 100644 --- a/test/psych/test_coder.rb +++ b/test/psych/test_coder.rb @@ -89,6 +89,17 @@ module Psych end end + class RepresentWithObject + def encode_with coder + coder.represent_object self.class.name, 20 + end + end + + def test_represent_with_object + thing = Psych.load(Psych.dump(RepresentWithObject.new)) + assert_equal 20, thing + end + def test_json_dump_exclude_tag refute_match('TestCoder::InitApi', Psych.to_json(InitApi.new)) end |