Skip to content

Commit

Permalink
Make #auth_capable? public
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nevans committed Oct 15, 2023
1 parent c41e299 commit 6d51323
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/net/smtp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 6d51323

Please sign in to comment.