Module: Aker::Deprecation

Defined in:
lib/aker/deprecation.rb

Overview

Defines deprecation warnings and errors for pieces of the library which are being phased out.

This is an internal API in Aker. If there's a use for it outside, it could be factored out.

Defined Under Namespace

Classes: ObsoleteError, StderrMode

Class Attribute Summary (collapse)

Class Method Summary (collapse)

Class Attribute Details

+ (#report) mode

An object which determines what will happen to the messages generated by notify. It should respond to one method; see StderrMode for details.

The default is an instance of StderrMode.



21
22
23
# File 'lib/aker/deprecation.rb', line 21

def mode
  @mode ||= default_mode
end

Class Method Details

+ notify(message, version)

This method returns an undefined value.

Indicates that the method it was called from is deprecated and could be removed as of the specified version.



32
33
34
35
36
37
38
# File 'lib/aker/deprecation.rb', line 32

def notify(message, version)
  level = determine_level(version)
  mode.report(level,
              full_message_for(level, message, version,
                               caller[1].split('/').last.split(':')[0,2].join(':')),
              version)
end