diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-03-08 13:33:13 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-03-08 13:33:13 -0800 |
commit | f506d5e4762b74536a5821392f06ec1c24e89536 (patch) | |
tree | c449da921454610a587b0cfa23a89d965b16a210 /lib | |
parent | 34d3b22d2b94e58b0e51ac922ea48d686fcbb901 (diff) | |
download | psych-f506d5e4762b74536a5821392f06ec1c24e89536.zip |
* 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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/psych.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/psych.rb b/lib/psych.rb index 69f3a7c..df3acc0 100644 --- a/lib/psych.rb +++ b/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 ### |