diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-29 23:57:25 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-29 23:57:25 +0000 |
commit | 797f482fe89cf9af1467fc0e7f0707d8c5e4141f (patch) | |
tree | 6b83b7cebe41aa848f237fed80ed8b0d626bc5fd /lib | |
parent | c294fcc0abe83bae433bc08b009db1d03b39e864 (diff) | |
download | ruby-797f482fe89cf9af1467fc0e7f0707d8c5e4141f.tar.gz |
* lib/psych.rb: Fix problem with empty and white-space only strings.
Thanks Peter McLain!
* test/psych/test_psych.rb: tests for change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 574bc7e641..c14259373a 100644 --- a/lib/psych.rb +++ b/lib/psych.rb @@ -101,7 +101,8 @@ module Psych # Psych.load("--- a") # => 'a' # Psych.load("---\n - a\n - b") # => ['a', 'b'] def self.load yaml - parse(yaml).to_ruby + result = parse(yaml) + result ? result.to_ruby : result end ### @@ -113,7 +114,8 @@ module Psych # # See Psych::Nodes for more information about YAML AST. def self.parse yaml - parse_stream(yaml).children.first.children.first + children = parse_stream(yaml).children + children.empty? ? false : children.first.children.first end ### |