Module: RR::Deprecations
- Defined in:
- lib/rr/deprecations.rb
Class Method Summary collapse
- .constant_deprecated_in_favor_of(old_name, new_name) ⇒ Object
- .show_warning(msg, options = {}) ⇒ Object
- .show_warning_for_deprecated_adapter ⇒ Object
Class Method Details
.constant_deprecated_in_favor_of(old_name, new_name) ⇒ Object
85 86 87 88 |
# 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 = {}) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/rr/deprecations.rb', line 69 def self.show_warning(msg, = {}) start_backtrace_at_frame = .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 ⇒ Object
90 91 92 93 94 95 |
# 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 |