From d5485500157adcf3b4d3b3708b504a8a3a089ddf Mon Sep 17 00:00:00 2001 From: nick evans Date: Wed, 11 Oct 2023 13:50:49 -0400 Subject: [PATCH] Reimplement `#authenticate` using `#auth` IMO, the method signature for `#authenticate` is confusing and it the method should be deprecated in favor of `#auth`. --- lib/net/smtp.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb index bcf965e..da04391 100644 --- a/lib/net/smtp.rb +++ b/lib/net/smtp.rb @@ -896,18 +896,15 @@ def open_message_stream(from_addr, *to_addrs, &block) # :yield: stream # All arguments—other than +type+—are forwarded to the authenticator. # Different authenticators may interpret the +username+ and +secret+ # arguments differently. - def authenticate(*args, type: nil, **kwargs, &block) + def authenticate(*args, **kwargs, &block) case args.length when 1, 3 then typearg = args.pop when (4..) raise ArgumentError, "wrong number of arguments " \ "(given %d, expected 0..3)" % [args.length] end - authtype = type || typearg || DEFAULT_AUTH_TYPE - check_auth_method authtype check_auth_args(*args) unless args.empty? - authenticator = Authenticator.auth_class(authtype).new(self) - critical { authenticator.auth(*args, **kwargs) } + auth(typearg, *args, **kwargs, &block) end # call-seq: