From 3de2ab7fdb5201133718b45dfdeb82f4794f99bc Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Wed, 31 Jan 2024 11:01:31 +0900 Subject: [PATCH] [ruby/yaml] Make PStore support as optional https://github.com/ruby/yaml/commit/da421ce46f --- lib/yaml/store.rb | 8 ++++++-- test/yaml/test_store.rb | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/yaml/store.rb b/lib/yaml/store.rb index 88dd1b978c..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. @@ -83,4 +87,4 @@ class YAML::Store < PStore def empty_marshal_checksum CHECKSUM_ALGO.digest(empty_marshal_data) end -end +end if defined?(::PStore) diff --git a/test/yaml/test_store.rb b/test/yaml/test_store.rb index 74557db964..d389530271 100644 --- a/test/yaml/test_store.rb +++ b/test/yaml/test_store.rb @@ -177,4 +177,4 @@ class YAMLStoreTest < Test::Unit::TestCase end assert_equal(indentation_3_yaml, File.read(@yaml_store_file), bug12800) end -end +end if defined?(::YAML::Store)