Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract public quit!/disconnect from do_finish
This renames `#do_finish` to `#quit!`, makes it public, adds an option to convert exceptions into warnings, and extracts the contents of the ensure block into a new public `#disconnect` method. The motivation for making these public is given in the rdoc. As documented in the rdoc, `#quit!`: > Calls #quit and ensures that #disconnect is called. Returns the > result from #quit. Returns +nil+ when the client is already > disconnected or when a prior error prevents the client from calling > #quit. Unlike #finish, this an exception will not be raised when the > client has not started. > > When <tt>exception: :warn</tt> is specified, when #quit raises a > StandardError, a warning will be printed and the exception is > returned, not re-raised. When <tt>exception: false</tt> is specified, > a warning will not be printed. This is useful when the connection > must be dropped, for example in a test suite or due to security > concerns. As documented in the rdoc, `#disconnect`: > Disconnects the socket without checking if the connection has started > yet, and without sending a final QUIT message to the server. > > Generally, either #finish or #quit! should be used instead.
- Loading branch information