Module: Deprecations::Warn

Defined in:
lib/deprecations/behavior.rb

Class Method Summary collapse

Class Method Details

.call(subject, alternative, outdated) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/deprecations/behavior.rb', line 47

def self.call(subject, alternative, outdated)
  location = caller_locations(4, 1).last and location = "#{location.path}:#{location.lineno}: "
  msg = "#{location}[DEPRECATION] `#{subject}` is deprecated"
  msg << (outdated ? " and will be outdated #{outdated}." : '.')
  alternative and msg << " Please use `#{alternative}` instead."
  ::Kernel.warn(msg)
end