summaryrefslogtreecommitdiffstats
path: root/lib/yaml
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-11 07:43:31 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-11 07:43:31 +0000
commit067cf063987d0910858fd8396e2397e0aa096fa6 (patch)
tree8f45c73975b97dda9094a58f52815cc5b8230031 /lib/yaml
parent2517defedafdb8b3e1bc9b77ed02c1684a8ab332 (diff)
downloadruby-067cf063987d0910858fd8396e2397e0aa096fa6.tar.gz
ruby-067cf063987d0910858fd8396e2397e0aa096fa6.tar.xz
ruby-067cf063987d0910858fd8396e2397e0aa096fa6.zip
* lib/yaml/store.rb (YAML::load): modified to support empty
database. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/yaml')
-rw-r--r--lib/yaml/store.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/yaml/store.rb b/lib/yaml/store.rb
index 4f0384cc5..e3a8e9fcd 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