From 6d5132301e27fae50b4fa7568310317446468130 Mon Sep 17 00:00:00 2001 From: nick evans Date: Thu, 28 Sep 2023 08:43:34 -0400 Subject: [PATCH] Make `#auth_capable?` public This can be useful to users of the library, in the same way that `#capable?`, `#capabilities`, and `#capable_auth_types` are all useful. I suggest deprecating the specific mechanism predicate methods (`capable_plain_auth?`, `capable_login_auth?`, and `capable_cram_md5_auth?`), as they are all replaced by this. --- lib/net/smtp.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb index 145f897..075adef 100644 --- a/lib/net/smtp.rb +++ b/lib/net/smtp.rb @@ -316,12 +316,13 @@ def capable_cram_md5_auth? auth_capable?('CRAM-MD5') end + # Returns whether the server advertises support for the authentication type. + # You cannot get valid result before opening SMTP session. def auth_capable?(type) return nil unless @capabilities return false unless @capabilities['AUTH'] @capabilities['AUTH'].include?(type) end - private :auth_capable? # Returns supported authentication methods on this server. # You cannot get valid value before opening SMTP session.