Module: Timezone::Deprecate

Defined in:
lib/timezone/deprecate.rb

Overview

This class provides a way to set a custom hook for deprecations.

Class Attribute Summary collapse

Class Attribute Details

.callback=(value) ⇒ Object

Set the custom deprecation callback. By default this issues a deprecation warning.

Examples:

Send a message to StatsD

Timezone::Deprecate.callback = lambda do |klass, method, _|
  StatsD.increment(sanitize(klass, method))
end

Send a message to a custom logger

Timezone::Deprecate.callback = lambda do |klass, method, msg|
  MyLogger.log("[#{klass} : #{method}] #{msg}")
end

Parameters:

  • callback (#call)

    the custom callback



21
22
23
# File 'lib/timezone/deprecate.rb', line 21

def callback=(value)
  @callback = value
end