Skip to content

Commit

Permalink
[Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
Browse files Browse the repository at this point in the history
  • Loading branch information
kronn authored and nevans committed Apr 9, 2024
1 parent ef51505 commit 2204351
Show file tree
Hide file tree
Showing 37 changed files with 292 additions and 292 deletions.
50 changes: 25 additions & 25 deletions lib/mail/body.rb
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
# encoding: utf-8
# frozen_string_literal: true
module Mail

# = Body
#
#
# The body is where the text of the email is stored. Mail treats the body
# as a single object. The body itself has no information about boundaries
# used in the MIME standard, it just looks at its content as either a single
# block of text, or (if it is a multipart message) as an array of blocks of text.
#
#
# A body has to be told to split itself up into a multipart message by calling
# #split with the correct boundary. This is because the body object has no way
# of knowing what the correct boundary is for itself (there could be many
# boundaries in a body in the case of a nested MIME text).
#
#
# Once split is called, Mail::Body will slice itself up on this boundary,
# assigning anything that appears before the first part to the preamble, and
# anything that appears after the closing boundary to the epilogue, then
# each part gets initialized into a Mail::Part object.
#
#
# The boundary that is used to split up the Body is also stored in the Body
# object for use on encoding itself back out to a string. You can
# object for use on encoding itself back out to a string. You can
# overwrite this if it needs to be changed.
#
#
# On encoding, the body will return the preamble, then each part joined by
# the boundary, followed by a closing boundary string and then the epilogue.
class Body
Expand Down Expand Up @@ -57,15 +57,15 @@ def init_with(coder)

# Matches this body with another body. Also matches the decoded value of this
# body with a string.
#
#
# Examples:
#
#
# body = Mail::Body.new('The body')
# body == body #=> true
#
#
# body = Mail::Body.new('The body')
# body == 'The body' #=> true
#
#
# body = Mail::Body.new("VGhlIGJvZHk=\n")
# body.encoding = 'base64'
# body == "The body" #=> true
Expand All @@ -76,28 +76,28 @@ def ==(other)
super
end
end

# Accepts a string and performs a regular expression against the decoded text
#
#
# Examples:
#
#
# body = Mail::Body.new('The body')
# body =~ /The/ #=> 0
#
#
# body = Mail::Body.new("VGhlIGJvZHk=\n")
# body.encoding = 'base64'
# body =~ /The/ #=> 0
def =~(regexp)
self.decoded =~ regexp
end

# Accepts a string and performs a regular expression against the decoded text
#
#
# Examples:
#
#
# body = Mail::Body.new('The body')
# body.match(/The/) #=> #<MatchData "The">
#
#
# body = Mail::Body.new("VGhlIGJvZHk=\n")
# body.encoding = 'base64'
# body.match(/The/) #=> #<MatchData "The">
Expand Down Expand Up @@ -125,7 +125,7 @@ def include?(other)
def set_sort_order(order)
@part_sort_order = order
end

# Allows you to sort the parts according to the default sort order, or the sort order you
# set with :set_sort_order.
#
Expand All @@ -137,7 +137,7 @@ def sort_parts!
end
@parts.sort!(@part_sort_order)
end

def negotiate_best_encoding(message_encoding, allowed_encodings = nil)
Mail::Encodings::TransferEncoding.negotiate(message_encoding, encoding, raw_source, allowed_encodings)
end
Expand All @@ -164,7 +164,7 @@ def encoded(transfer_encoding = nil)
# Cannot decode, so skip normalization
raw_source
else
# Decode then encode to normalize and allow transforming
# Decode then encode to normalize and allow transforming
# from base64 to Q-P and vice versa
decoded = dec.decode(raw_source)
if defined?(Encoding) && charset && charset != "US-ASCII"
Expand All @@ -183,7 +183,7 @@ def decoded
Encodings.get_encoding(encoding).decode(raw_source)
end
end

def to_s
decoded
end
Expand Down Expand Up @@ -289,11 +289,11 @@ def extract_parts
end
parts.map(&:first)
end

def crlf_boundary
"\r\n--#{boundary}\r\n"
end

def end_boundary
"\r\n--#{boundary}--\r\n"
end
Expand Down
2 changes: 1 addition & 1 deletion lib/mail/field_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# frozen_string_literal: true
module Mail

# Field List class provides an enhanced array that keeps a list of
# Field List class provides an enhanced array that keeps a list of
# email fields in order. And allows you to insert new fields without
# having to worry about the order they will appear in.
class FieldList < Array
Expand Down
52 changes: 26 additions & 26 deletions lib/mail/mail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,45 @@
module Mail

# Allows you to create a new Mail::Message object.
#
#
# You can make an email via passing a string or passing a block.
#
#
# For example, the following two examples will create the same email
# message:
#
#
# Creating via a string:
#
#
# string = "To: [email protected]\r\n"
# string << "From: [email protected]\r\n"
# string << "Subject: This is an email\r\n"
# string << "\r\n"
# string << "This is the body"
# Mail.new(string)
#
#
# Or creating via a block:
#
#
# message = Mail.new do
# to '[email protected]'
# from '[email protected]'
# subject 'This is an email'
# body 'This is the body'
# end
#
#
# Or creating via a hash (or hash like object):
#
#
# message = Mail.new({:to => '[email protected]',
# 'from' => '[email protected]',
# :subject => 'This is an email',
# :body => 'This is the body' })
#
#
# Note, the hash keys can be strings or symbols, the passed in object
# does not need to be a hash, it just needs to respond to :each_pair
# and yield each key value pair.
#
#
# As a side note, you can also create a new email through creating
# a Mail::Message object directly and then passing in values via string,
# symbol or direct method calls. See Mail::Message for more information.
#
#
# mail = Mail.new
# mail.to = '[email protected]'
# mail[:from] = '[email protected]'
Expand All @@ -54,20 +54,20 @@ def self.new(*args, &block)
# Sets the default delivery method and retriever method for all new Mail objects.
# The delivery_method and retriever_method default to :smtp and :pop3, with defaults
# set.
#
#
# So sending a new email, if you have an SMTP server running on localhost is
# as easy as:
#
#
# Mail.deliver do
# to '[email protected]'
# from '[email protected]'
# subject 'hi there!'
# body 'this is a body'
# end
#
#
# If you do not specify anything, you will get the following equivalent code set in
# every new mail object:
#
#
# Mail.defaults do
# delivery_method :smtp, { :address => "localhost",
# :port => 25,
Expand All @@ -76,24 +76,24 @@ def self.new(*args, &block)
# :password => nil,
# :authentication => nil,
# :enable_starttls_auto => true }
#
#
# retriever_method :pop3, { :address => "localhost",
# :port => 995,
# :user_name => nil,
# :password => nil,
# :enable_ssl => true }
# end
#
#
# Mail.delivery_method.new #=> Mail::SMTP instance
# Mail.retriever_method.new #=> Mail::POP3 instance
#
# Each mail object inherits the default set in Mail.delivery_method, however, on
# a per email basis, you can override the method:
#
# mail.delivery_method :smtp
#
#
# Or you can override the method and pass in settings:
#
#
# mail.delivery_method :smtp, :address => 'some.host'
def self.defaults(&block)
Configuration.instance.instance_eval(&block)
Expand All @@ -112,21 +112,21 @@ def self.retriever_method
# Send an email using the default configuration. You do need to set a default
# configuration first before you use self.deliver, if you don't, an appropriate
# error will be raised telling you to.
#
#
# If you do not specify a delivery type, SMTP will be used.
#
#
# Mail.deliver do
# to '[email protected]'
# from '[email protected]'
# subject 'This is a test email'
# body 'Not much to say here'
# end
#
#
# You can also do:
#
#
# mail = Mail.read('email.eml')
# mail.deliver!
#
#
# And your email object will be created and sent.
def self.deliver(*args, &block)
mail = self.new(args, &block)
Expand Down Expand Up @@ -190,7 +190,7 @@ def Mail.connection(&block)

# You can register an object to be informed of every email that is sent through
# this method.
#
#
# Your object needs to respond to a single method #delivered_email(mail)
# which receives the email that is sent.
def self.register_observer(observer)
Expand All @@ -208,7 +208,7 @@ def self.unregister_observer(observer)
# You can register an object to be given every mail object that will be sent,
# before it is sent. So if you want to add special headers or modify any
# email that gets sent through the Mail library, you can do so.
#
#
# Your object needs to respond to a single method #delivering_email(mail)
# which receives the email that is about to be sent. Make your modifications
# directly to this object.
Expand Down
4 changes: 2 additions & 2 deletions lib/mail/network/delivery_methods/file_delivery.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
module Mail
# FileDelivery class delivers emails into multiple files based on the destination
# address. Each file is appended to if it already exists.
#
#
# So if you have an email going to fred@test, bob@test, joe@anothertest, and you
# set your location path to /path/to/mails then FileDelivery will create the directory
# if it does not exist, and put one copy of the email in three files, called
# by their message id
#
#
# Make sure the path you specify with :location is writable by the Ruby process
# running Mail.
class FileDelivery
Expand Down
14 changes: 7 additions & 7 deletions lib/mail/network/delivery_methods/smtp_connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,39 @@

module Mail
# == Sending Email with SMTP
#
#
# Mail allows you to send emails using an open SMTP connection. This is done by
# passing a created Net::SMTP object. This way we can get better performance to
# our local mail server by reducing the number of connections at any one time.
#
# === Sending via SMTP server on Localhost
#
#
# To send mail open a connection with Net::Smtp using any options you like
# === Delivering the email
#
#
# Once you have the settings right, sending the email is done by:
#
# smtp_conn = Net::SMTP.start(settings[:address], settings[:port])
# Mail.defaults do
# delivery_method :smtp_connection, { :connection => smtp_conn }
# end
#
#
# Mail.deliver do
# to '[email protected]'
# from '[email protected]'
# subject 'testing sendmail'
# body 'testing sendmail'
# end
#
#
# Or by calling deliver on a Mail message
#
#
# mail = Mail.new do
# to '[email protected]'
# from '[email protected]'
# subject 'testing sendmail'
# body 'testing sendmail'
# end
#
#
# mail.deliver!
class SMTPConnection
attr_accessor :smtp, :settings
Expand Down
8 changes: 4 additions & 4 deletions lib/mail/network/delivery_methods/test_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
module Mail
# The TestMailer is a bare bones mailer that does nothing. It is useful
# when you are testing.
#
#
# It also provides a template of the minimum methods you require to implement
# if you want to make a custom mailer for Mail
class TestMailer
Expand All @@ -14,11 +14,11 @@ def self.deliveries
end

# Allows you to over write the default deliveries store from an array to some
# other object. If you just want to clear the store,
# other object. If you just want to clear the store,
# call TestMailer.deliveries.clear.
#
#
# If you place another object here, please make sure it responds to:
#
#
# * << (message)
# * clear
# * length
Expand Down
Loading

0 comments on commit 2204351

Please sign in to comment.