Module: Esse::Deprecations::Deprecate::InstanceMethods

Defined in:
lib/esse/deprecations/deprecate.rb

Instance Method Summary collapse

Instance Method Details

#warning(method, repl, year, month) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/esse/deprecations/deprecate.rb', line 12

def warning(method, repl, year, month)
  msg = ["NOTE: #{method} is deprecated"]
  msg << if repl == :none
    ' with no replacement'
  elsif repl.respond_to?(:call)
    "; use #{repl.call} instead"
  else
    "; use #{repl} instead"
  end
  msg << '. It will be removed on or after %4d-%02d-01.' % [year, month]
  msg << "\n#{method} called from #{Gem.location_of_caller(2).join(':')}"

  warn "#{msg.join}." unless Gem::Deprecate.skip
end