lib/chatterbox.rb in chatterbox-0.6.2 vs lib/chatterbox.rb in chatterbox-0.8.1

- old
+ new

@@ -1,22 +1,32 @@ require 'active_support' module Chatterbox - def handle_notice(message) + def notify(message) publish_notice(message) message end - alias_method :notify, :handle_notice - def publish_notice(message) Publishers.publishers.each { |p| p.call(message.with_indifferent_access) } end + def handle_notice(message) + warning = "Chatterbox#handle_notice is deprecated and will be removed from Chatterbox 1.0. Call Chatterbox#notify instead." + deprecate(warning, caller) + notify(message) + end + + def deprecate(message, callstack) + ActiveSupport::Deprecation.warn(message, callstack) + end + + # Retrieve (lazily loaded) logger; defaults to a nil Logger def logger @logger ||= Logger.new(nil) end + # Set default logger for Chatterbox to use; mostly for development and debugging purposes def logger=(logger) @logger = logger end def register(&blk) \ No newline at end of file