module RR::Deprecations

Public Class Methods

constant_deprecated_in_favor_of(old_name, new_name) click to toggle source
# File lib/rr/deprecations.rb, line 85
def self.constant_deprecated_in_favor_of(old_name, new_name)
  show_warning "#{old_name} is deprecated;\nplease use #{new_name} instead.",
    :start_backtrace_at_frame => 3
end
show_warning(msg, options = {}) click to toggle source
# File lib/rr/deprecations.rb, line 69
def self.show_warning(msg, options = {})
  start_backtrace_at_frame = options.fetch(:start_backtrace_at_frame, 2)
  backtrace = caller(start_backtrace_at_frame)

  lines = []
  lines << ('-' * 80)
  lines << 'Warning from RR:'
  lines.concat msg.split(/\n/).map {|l| "  #{l}" }
  lines << ""
  lines << "Called from:"
  lines.concat backtrace[0..2].map {|l| " - #{l}" }
  lines << ('-' * 80)

  Kernel.warn lines.join("\n")
end
show_warning_for_deprecated_adapter() click to toggle source
# File lib/rr/deprecations.rb, line 90
    def self.show_warning_for_deprecated_adapter
      RR::Deprecations.show_warning(<<EOT.strip)
RR now has an autohook system. You don't need to `include RR::Adapters::*` in
your test framework's base class anymore.
EOT
    end