From e896f4689a8fc54979f0a6c2b7ce14746856bad6 Mon Sep 17 00:00:00 2001 From: Adam Cooke Date: Sat, 10 Feb 2024 23:23:29 +0000 Subject: [PATCH] style(rubocop): Style/ClassAndModuleChildren --- config/initializers/smtp_extensions.rb | 72 +++++++++++++------------- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/config/initializers/smtp_extensions.rb b/config/initializers/smtp_extensions.rb index 85dd1e6..f6db89c 100644 --- a/config/initializers/smtp_extensions.rb +++ b/config/initializers/smtp_extensions.rb @@ -1,40 +1,42 @@ # frozen_string_literal: true -class Net::SMTP::Response +module Net + class SMTP + + attr_accessor :source_address + + def secure_socket? + @socket.io.is_a?(OpenSSL::SSL::SSLSocket) + end + + # + # We had an issue where a message was sent to a server and was greylisted. It returned + # a Net::SMTPUnknownError error. We then tried to send another message on the same + # connection after running `rset` the next message didn't raise any exceptions because + # net/smtp returns a '200 dummy reply code' and doesn't raise any exceptions. + # + def rset + @error_occurred = false + getok("RSET") + end + + def rset_errors + @error_occurred = false + end + + private + + def tcp_socket(address, port) + TCPSocket.open(address, port, source_address) + end + + class Response + + def message + @string + end + + end - def message - @string end - -end - -class Net::SMTP - - attr_accessor :source_address - - def secure_socket? - @socket.io.is_a?(OpenSSL::SSL::SSLSocket) - end - - # - # We had an issue where a message was sent to a server and was greylisted. It returned - # a Net::SMTPUnknownError error. We then tried to send another message on the same - # connection after running `rset` the next message didn't raise any exceptions because - # net/smtp returns a '200 dummy reply code' and doesn't raise any exceptions. - # - def rset - @error_occurred = false - getok("RSET") - end - - def rset_errors - @error_occurred = false - end - - private - - def tcp_socket(address, port) - TCPSocket.open(address, port, source_address) - end - end