From 3f0387830924822fde321e3613ced1607ffc27c6 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 11 Apr 2008 07:43:31 +0000 Subject: * lib/yaml/store.rb (YAML::load): modified to support empty database. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/yaml/store.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'lib/yaml/store.rb') diff --git a/lib/yaml/store.rb b/lib/yaml/store.rb index 4f0384cc5e..e3a8e9fcdd 100644 --- a/lib/yaml/store.rb +++ b/lib/yaml/store.rb @@ -20,10 +20,24 @@ class YAML::Store < PStore end def load(content) - YAML::load(content) + table = YAML::load(content) + if table == false + {} + else + table + end end def marshal_dump_supports_canonical_option? false end + + EMPTY_MARSHAL_DATA = {}.to_yaml + EMPTY_MARSHAL_CHECKSUM = Digest::MD5.digest(EMPTY_MARSHAL_DATA) + def empty_marshal_data + EMPTY_MARSHAL_DATA + end + def empty_marshal_checksum + EMPTY_MARSHAL_CHECKSUM + end end -- cgit v1.2.3