diff options
Diffstat (limited to 'lib/yaml/store.rb')
-rw-r--r-- | lib/yaml/store.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/yaml/store.rb b/lib/yaml/store.rb index f8650b942f..f24e4ad332 100644 --- a/lib/yaml/store.rb +++ b/lib/yaml/store.rb @@ -3,7 +3,11 @@ # YAML::Store # require 'yaml' -require 'pstore' + +begin + require 'pstore' +rescue LoadError +end # YAML::Store provides the same functionality as PStore, except it uses YAML # to dump objects instead of Marshal. @@ -65,7 +69,7 @@ class YAML::Store < PStore end def load(content) - table = YAML.unsafe_load(content) + table = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(content) : YAML.load(content) if table == false {} else @@ -83,4 +87,4 @@ class YAML::Store < PStore def empty_marshal_checksum CHECKSUM_ALGO.digest(empty_marshal_data) end -end +end if defined?(::PStore) |