Object
An Alerter formats and emits alerts, and formats and emits reports.
If you wish to impelement your own Alerter class, then it must implement the following methods:
alert( DeprecatedMethod, CallSite )
final_reort()
These are the two methods that are invoked by the Deprecatable system at various points.
Public: Alert that the deprecated method was invoked at a specific call site.
deprecated_method - an instance of DeprecatedMethod call_site - an instance of CallSite showing this particular
invocation
Returns nothing.
# File lib/deprecatable/alerter.rb, line 23 def alert( deprecated_method, call_site ) lines = deprecated_method_report( deprecated_method, call_site ) lines << "To turn this report off do one of the following:" lines << "* in your ruby code set `Deprecatable.options.alert_frequency = :never`" lines << "* set the environment variable `DEPRECATABLE_ALERT_FREQUENCY=\"never\"`" lines << "" lines.each { |l| warn_with_prefix l } end
Public: Render the final deprecation report showing when and where all deprecated methods in the Registry were calld.
registry - An instance of Deprecatable::Registry
(default: Deprecatable.registry)
Returns nothing.
# File lib/deprecatable/alerter.rb, line 39 def final_report( registry = Deprecatable.registry ) lines = [ "Deprecatable 'at_exit' Report", "=============================" ] lines << "" lines << "To turn this report off do one of the following:" lines << "" lines << "* in your ruby code set `Deprecatable.options.has_at_exit_report = false`" lines << "* set the environment variable `DEPRECATABLE_HAS_AT_EXIT_REPORT=\"false\"`" lines << "" registry.items.each do |dm| lines += deprecated_method_report( dm ) end lines.each { |l| warn_without_prefix l } end
Generated with the Darkfish Rdoc Generator 2.