From 441958396f40d526a62e564761d2bad534465a5b Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Wed, 19 May 2021 16:07:24 +0200 Subject: 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. --- lib/psych/exception.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/psych/exception.rb') diff --git a/lib/psych/exception.rb b/lib/psych/exception.rb index fac0c42..f473b95 100644 --- a/lib/psych/exception.rb +++ b/lib/psych/exception.rb @@ -7,8 +7,8 @@ module Psych end class DisallowedClass < Exception - def initialize klass_name - super "Tried to load unspecified class: #{klass_name}" + def initialize action, klass_name + super "Tried to #{action} unspecified class: #{klass_name}" end end end -- cgit v1.2.3