summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/psych/visitors/to_ruby.rb2
-rw-r--r--test/visitors/test_yast_builder.rb1
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/psych/visitors/to_ruby.rb b/lib/psych/visitors/to_ruby.rb
index 10e03fe..ee603ff 100644
--- a/lib/psych/visitors/to_ruby.rb
+++ b/lib/psych/visitors/to_ruby.rb
@@ -14,7 +14,7 @@ module Psych
return nil if o.tag == 'tag:yaml.org,2002:null'
unless o.quoted
- return nil if o.value =~ /^(null|~)$/i
+ return nil if o.value =~ /^(null|~)$/i or o.value.empty?
end
o.value
diff --git a/test/visitors/test_yast_builder.rb b/test/visitors/test_yast_builder.rb
index aa6f332..67d54be 100644
--- a/test/visitors/test_yast_builder.rb
+++ b/test/visitors/test_yast_builder.rb
@@ -45,6 +45,7 @@ module Psych
assert_equal nil, Psych.load('Null')
assert_equal nil, Psych.load('NULL')
assert_equal nil, Psych.load('~')
+ assert_equal({'foo' => nil}, Psych.load('foo: '))
assert_round_trip 'null'
assert_round_trip 'nUll'