summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--ext/psych/lib/psych/visitors/yaml_tree.rb1
-rw-r--r--test/psych/visitors/test_yaml_tree.rb7
3 files changed, 15 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 235c4ef47a..d86047537f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sun Oct 28 10:12:15 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * 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@tenderlovemaking.com>
* ext/psych/lib/psych/visitors/yaml_tree.rb: YAML Tree object should
diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb
index a9b2ebff37..9cbc05df4a 100644
--- a/ext/psych/lib/psych/visitors/yaml_tree.rb
+++ b/ext/psych/lib/psych/visitors/yaml_tree.rb
@@ -47,6 +47,7 @@ module Psych
def tree
finish unless finished?
+ @emitter.root
end
def push object
diff --git a/test/psych/visitors/test_yaml_tree.rb b/test/psych/visitors/test_yaml_tree.rb
index 3f2954c71e..496cdd05cc 100644
--- a/test/psych/visitors/test_yaml_tree.rb
+++ b/test/psych/visitors/test_yaml_tree.rb
@@ -8,6 +8,13 @@ module Psych
@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