Class: Aker::Deprecation::StderrMode

Inherits:
Object
  • Object
show all
Defined in:
lib/aker/deprecation.rb

Overview

The default deprecation handler for Aker. When a deprecated method is invoked, it does one of two things:

  • If the method is only deprecated (i.e., slated for removal in a future release), it prints a warning to standard error.
  • If a method's deprecation version is passed, it throws an ObsoleteError.

The motivation of the latter behavior is to force users to remove obsolete code before the hints about what to replace it with are removed.

Instance Method Summary collapse

Instance Method Details

#report(level, message, version)


92
93
94
95
96
97
# File 'lib/aker/deprecation.rb', line 92

def report(level, message, version)
  case level
  when :deprecated; $stderr.puts message;
  when :obsolete; raise ObsoleteError.new(message)
  end
end