module Timezone::Deprecate
This class provides a way to set a custom hook for deprecations.
Attributes
callback[W]
Set the custom deprecation callback. By default this issues a deprecation warning.
@param callback [#call] the custom callback
@example Send a message to StatsD
Timezone::Deprecate.callback = lambda do |klass, method, _| StatsD.increment(sanitize(klass, method)) end
@example Send a message to a custom logger
Timezone::Deprecate.callback = lambda do |klass, method, msg| MyLogger.log("[#{klass} : #{method}] #{msg}") end
Public Class Methods
call(klass, method, message)
click to toggle source
@!visibility private
# File lib/timezone/deprecate.rb, line 29 def call(klass, method, message) callback && callback.call(klass, method, message) end
callback()
click to toggle source
@!visibility private
# File lib/timezone/deprecate.rb, line 24 def callback @callback || ->(_, _, message) { warn(message) } end