Skip to content

Commit da421ce

Browse files
committed
Make PStore support as optional
1 parent f83b040 commit da421ce

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/yaml/store.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
# YAML::Store
44
#
55
require 'yaml'
6-
require 'pstore'
6+
7+
begin
8+
require 'pstore'
9+
rescue LoadError
10+
end
711

812
# YAML::Store provides the same functionality as PStore, except it uses YAML
913
# to dump objects instead of Marshal.
@@ -83,4 +87,4 @@ def empty_marshal_data
8387
def empty_marshal_checksum
8488
CHECKSUM_ALGO.digest(empty_marshal_data)
8589
end
86-
end
90+
end if defined?(::PStore)

test/yaml/test_store.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,4 @@ def test_with_options
177177
end
178178
assert_equal(indentation_3_yaml, File.read(@yaml_store_file), bug12800)
179179
end
180-
end
180+
end if defined?(::YAML::Store)

0 commit comments

Comments
 (0)