1 class Module # define deprecation api
2 DEPS = Hash.new { |h,k| h[k] = {} }
4 def tu_deprecation_warning old, new = nil, kaller = nil
6 unless DEPS[old][kaller] then
7 msg = "#{self}##{old} deprecated. "
8 msg += new ? "Use ##{new}" : "No replacement is provided"
9 msg += ". From #{kaller}."
12 DEPS[old][kaller] = true
15 def tu_deprecate old, new
17 def #{old} *args, &block
18 cls, clr = self.class, caller.first
19 self.class.tu_deprecation_warning #{old.inspect}, #{new.inspect}, clr