summaryrefslogtreecommitdiff
path: root/lib/psych/class_loader.rb
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2021-05-19 16:07:24 +0200
committerJean Boussier <jean.boussier@gmail.com>2021-05-19 16:24:18 +0200
commit441958396f40d526a62e564761d2bad534465a5b (patch)
treed8fe066d81bafe293c34d600e9fe58a130505cae /lib/psych/class_loader.rb
parent3fabcb953f04b4c4927b419d6d91026f65e984af (diff)
downloadpsych-441958396f40d526a62e564761d2bad534465a5b.zip
Implement YAML.safe_dump to make safe_load more usable.
In case where Psych is used as a two way serializers, e.g. to serialize some cache or config, it is preferable to have the same restrictions on both load and dump. Otherwise you might dump and persist some objects payloads that you later won't be able to read.
Diffstat (limited to 'lib/psych/class_loader.rb')
-rw-r--r--lib/psych/class_loader.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/psych/class_loader.rb b/lib/psych/class_loader.rb
index a5d1a7a..088373c 100644
--- a/lib/psych/class_loader.rb
+++ b/lib/psych/class_loader.rb
@@ -86,7 +86,7 @@ module Psych
if @symbols.include? sym
super
else
- raise DisallowedClass, 'Symbol'
+ raise DisallowedClass.new('load', 'Symbol')
end
end
@@ -96,7 +96,7 @@ module Psych
if @classes.include? klassname
super
else
- raise DisallowedClass, klassname
+ raise DisallowedClass.new('load', klassname)
end
end
end