summaryrefslogtreecommitdiff
path: root/ext/psych/lib/psych.rb
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-08 21:31:05 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-08 21:31:05 +0000
commit240c9acb5c3ee0b3d538cf9ba12cb27f5e469dca (patch)
tree7db67f8d858a043da2593e0b0591f44c8050f0e5 /ext/psych/lib/psych.rb
parenta2e3de1b3f876dd9b14fa3a6291a202719405382 (diff)
* ext/psych/lib/psych.rb (load, parse): stop parsing or loading after
the first document has been parsed. * test/psych/test_stream.rb: pertinent tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/psych/lib/psych.rb')
-rw-r--r--ext/psych/lib/psych.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/psych/lib/psych.rb b/ext/psych/lib/psych.rb
index 69f3a7c1fe..df3acc0aff 100644
--- a/ext/psych/lib/psych.rb
+++ b/ext/psych/lib/psych.rb
@@ -148,8 +148,10 @@ module Psych
#
# See Psych::Nodes for more information about YAML AST.
def self.parse yaml, filename = nil
- children = parse_stream(yaml, filename).children
- children.empty? ? false : children.first.children.first
+ parse_stream(yaml, filename) do |node|
+ return node
+ end
+ false
end
###