lib/errata.rb in errata-1.1.0 vs lib/errata.rb in errata-1.1.1

- old
+ new

@@ -21,17 +21,18 @@ # If and only if you don't pass <tt>:table</tt>, all other options will be passed to a new RemoteTable (for example, <tt>:url</tt>, etc.) def initialize(options = {}) options = options.symbolize_keys responder = options.delete :responder - raise "[errata] :responder is required" unless responder if responder.is_a?(::String) @lazy_load_responder_mutex = ::Mutex.new @lazy_load_responder_class_name = responder - else + elsif responder ::Kernel.warn %{[errata] Passing an object as :responder is deprecated. It's recommended to pass a class name instead, which will be constantized and instantiated with no arguments.} @responder = responder + else + @no_responder = true end if table = options.delete(:table) ::Kernel.warn %{[errata] Passing :table is deprecated. It's recommended to pass table options instead.} @table = table @@ -50,9 +51,10 @@ corrections.each { |erratum| erratum.correct!(row) } nil end def responder + return if @no_responder == true @responder || @lazy_load_responder_mutex.synchronize do @responder ||= lazy_load_responder_class_name.constantize.new end end