diff options
author | Jean Boussier <jean.boussier@gmail.com> | 2021-05-19 16:07:24 +0200 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2021-05-19 16:24:18 +0200 |
commit | 441958396f40d526a62e564761d2bad534465a5b (patch) | |
tree | d8fe066d81bafe293c34d600e9fe58a130505cae /lib/psych/class_loader.rb | |
parent | 3fabcb953f04b4c4927b419d6d91026f65e984af (diff) | |
download | psych-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.rb | 4 |
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 |