Method: Sequel::Deprecation.deprecate

Defined in:
lib/sequel/deprecated.rb

.deprecate(method, instead = nil) ⇒ Object

Print the message and possibly backtrace to the output.



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/sequel/deprecated.rb', line 40

def self.deprecate(method, instead=nil)
  return unless output
  message = instead ? "#{method} is deprecated and will be removed in Sequel 6.  #{instead}." : method
  message = "#{prefix}#{message}" if prefix
  output.puts(message)
  case b = backtrace_filter
  when Integer
    caller.each do |c|
      b -= 1
      output.puts(c)
      break if b <= 0
    end
  when true
    caller.each{|c| output.puts(c)}
  when Proc
    caller.each_with_index{|line, line_no| output.puts(line) if b.call(line, line_no)}
  end
  nil
end