File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ def names; @authenticators.keys end
68
68
# When only a single argument is given, the authenticator class will be
69
69
# lazily loaded from <tt>Net::IMAP::SASL::#{name}Authenticator</tt> (case is
70
70
# preserved and non-alphanumeric characters are removed..
71
- def add_authenticator ( name , authenticator = nil )
71
+ def add_authenticator ( name , authenticator = nil , warn_overwrite : true )
72
72
authenticator ||= begin
73
73
class_name = "#{ name . gsub ( /[^a-zA-Z0-9]/ , "" ) } Authenticator" . to_sym
74
74
auth_class = nil
@@ -78,6 +78,11 @@ def add_authenticator(name, authenticator = nil)
78
78
}
79
79
end
80
80
key = Authenticators . normalize_name ( name )
81
+ if warn_overwrite && ( original = @authenticators [ key ] )
82
+ warn ( "%p: replacing existing %p authenticator: %p" % [
83
+ self , key , original
84
+ ] , uplevel : 1 )
85
+ end
81
86
@authenticators [ key ] = authenticator
82
87
end
83
88
You can’t perform that action at this time.
0 commit comments