ruby-changes:25298
From: tenderlove <ko1@a...>
Date: Sun, 28 Oct 2012 10:13:30 +0900 (JST)
Subject: [ruby-changes:25298] tenderlove:r37350 (trunk): * ext/psych/lib/psych/visitors/yaml_tree.rb: `tree` should return the
tenderlove 2012-10-28 10:13:09 +0900 (Sun, 28 Oct 2012) New Revision: 37350 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37350 Log: * ext/psych/lib/psych/visitors/yaml_tree.rb: `tree` should return the same thing on every call. * test/psych/visitors/test_yaml_tree.rb: related test. Modified files: trunk/ChangeLog trunk/ext/psych/lib/psych/visitors/yaml_tree.rb trunk/test/psych/visitors/test_yaml_tree.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 37349) +++ ChangeLog (revision 37350) @@ -1,3 +1,10 @@ +Sun Oct 28 10:12:15 2012 Aaron Patterson <aaron@t...> + + * ext/psych/lib/psych/visitors/yaml_tree.rb: `tree` should return the + same thing on every call. + + * test/psych/visitors/test_yaml_tree.rb: related test. + Sun Oct 28 10:05:03 2012 Aaron Patterson <aaron@t...> * ext/psych/lib/psych/visitors/yaml_tree.rb: YAML Tree object should Index: ext/psych/lib/psych/visitors/yaml_tree.rb =================================================================== --- ext/psych/lib/psych/visitors/yaml_tree.rb (revision 37349) +++ ext/psych/lib/psych/visitors/yaml_tree.rb (revision 37350) @@ -47,6 +47,7 @@ def tree finish unless finished? + @emitter.root end def push object Index: test/psych/visitors/test_yaml_tree.rb =================================================================== --- test/psych/visitors/test_yaml_tree.rb (revision 37349) +++ test/psych/visitors/test_yaml_tree.rb (revision 37350) @@ -8,6 +8,13 @@ @v = Visitors::YAMLTree.new end + def test_tree_can_be_called_twice + @v.start + @v << Object.new + t = @v.tree + assert_equal t, @v.tree + end + def test_yaml_tree_can_take_an_emitter io = StringIO.new e = Psych::Emitter.new io -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/