Module: Qpid::Proton::Util::Deprecation

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

MATCH_DIR =
/#{File.dirname(File.dirname(__FILE__))}/
DEPRECATE_FULL_TRACE =
false

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.deprecated(old, new = nil) ⇒ Object



25
26
27
28
29
30
# File 'lib/util/deprecation.rb', line 25

def self.deprecated(old, new=nil)
  replace = new ? "use `#{new}`" : "internal use only"

  from = DEPRECATE_FULL_TRACE ? caller(2).join("\n") : caller.find { |l| not MATCH_DIR.match(l) }
  warn "[DEPRECATION] `#{old}` is deprecated, #{replace}. Called from #{from}"
end

.included(other) ⇒ Object



44
45
46
# File 'lib/util/deprecation.rb', line 44

def self.included(other)
  other.extend ClassMethods
end

Instance Method Details

#deprecated(*arg) ⇒ Object



32
# File 'lib/util/deprecation.rb', line 32

def deprecated(*arg) Deprecation.deprecated(*arg); end