lib/sanitize_email/deprecation.rb in sanitize_email-2.0.0 vs lib/sanitize_email/deprecation.rb in sanitize_email-2.0.1
- old
+ new
@@ -1,13 +1,14 @@
+# frozen_string_literal: true
+
# Copyright (c) 2008-16 Peter H. Boling of RailsBling.com
# Released under the MIT license
module SanitizeEmail
# Provides tools that allow methods to be deprecated with new releases of the gem.
# See http://www.seejohncode.com/2012/01/09/deprecating-methods-in-ruby/
module Deprecation
-
class << self
attr_accessor :deprecate_in_silence
end
@deprecate_in_silence = false
@@ -30,10 +31,10 @@
# Replace old method
old_name = :"#{name}_without_deprecation"
alias_method old_name, name
# And replace it with a wrapped version
define_method(name) do |*args, &block|
- self.deprecation(name, " (please use ##{replacement})")
+ deprecation(name, " (please use ##{replacement})")
send old_name, *args, &block
end
end
def deprecation(name, replacement = nil)