Module: DeprecationHelper

Included in:
ValidEmail2, ValidEmail2::Address, ValidEmail2::EmailValidator
Defined in:
lib/helpers/deprecation_helper.rb

Instance Method Summary collapse

Instance Method Details

#deprecate_method(old_method, new_method) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/helpers/deprecation_helper.rb', line 2

def deprecate_method(old_method, new_method)
  define_method(old_method) do |*args, &block|
    klass = is_a? Module
    target = klass ? "#{self}." : "#{self.class}#"
    warn "Warning: `#{target}#{old_method}` is deprecated and will be removed in version 6 of valid_email2; use `#{new_method}` instead."
    send(new_method, *args, &block)
  end
end

#deprecation_message(old_name, new_name) ⇒ Object



11
12
13
# File 'lib/helpers/deprecation_helper.rb', line 11

def deprecation_message(old_name, new_name)
  warn "Warning: `#{old_name}` is deprecated and will be removed in version 6 of valid_email2; use `#{new_name}` instead."
end