Commit 08484bf

mokha <mo@mokhan.ca>
2019-04-20 16:47:21
fix deprecation warning and provide alternative
1 parent 9fea6a6
Changed files (2)
lib/xml/kit/encryption.rb
@@ -18,7 +18,7 @@ module Xml
       )
         @symmetric_algorithm = symmetric_algorithm
         @asymmetric_algorithm = asymmetric_algorithm
-        Xml::Kit.deprecate('Encryption is deprecated. Use EncryptedData.')
+        Xml::Kit.deprecate('Encryption', alternative: 'EncryptedData')
         super(raw_xml,
           symmetric_cipher: symmetric(symmetric_algorithm),
           asymmetric_cipher: asymmetric(asymmetric_algorithm, public_key),
lib/xml/kit.rb
@@ -42,9 +42,13 @@ module Xml
 
       attr_writer :logger
 
-      def deprecate(message)
+      def deprecate(name, alternative: nil)
         @deprecation ||= ActiveSupport::Deprecation.new('1.0.0', 'xml-kit')
-        @deprecation.deprecation_warning(message)
+        if alternative
+          @deprecation.deprecation_warning(name, "Use `#{alternative}` instead")
+        else
+          @deprecation.deprecation_warning(name)
+        end
       end
     end
   end