Skip to content

Commit c9ea62c

Browse files
authored
Merge pull request #1510 from mikel/chore/remove-trailing-whitespace
[Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
2 parents 0588bee + 956a73e commit c9ea62c

38 files changed

+307
-307
lines changed

lib/mail/body.rb

+25-25
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
# encoding: utf-8
22
# frozen_string_literal: true
33
module Mail
4-
4+
55
# = Body
6-
#
6+
#
77
# The body is where the text of the email is stored. Mail treats the body
88
# as a single object. The body itself has no information about boundaries
99
# used in the MIME standard, it just looks at its content as either a single
1010
# block of text, or (if it is a multipart message) as an array of blocks of text.
11-
#
11+
#
1212
# A body has to be told to split itself up into a multipart message by calling
1313
# #split with the correct boundary. This is because the body object has no way
1414
# of knowing what the correct boundary is for itself (there could be many
1515
# boundaries in a body in the case of a nested MIME text).
16-
#
16+
#
1717
# Once split is called, Mail::Body will slice itself up on this boundary,
1818
# assigning anything that appears before the first part to the preamble, and
1919
# anything that appears after the closing boundary to the epilogue, then
2020
# each part gets initialized into a Mail::Part object.
21-
#
21+
#
2222
# The boundary that is used to split up the Body is also stored in the Body
23-
# object for use on encoding itself back out to a string. You can
23+
# object for use on encoding itself back out to a string. You can
2424
# overwrite this if it needs to be changed.
25-
#
25+
#
2626
# On encoding, the body will return the preamble, then each part joined by
2727
# the boundary, followed by a closing boundary string and then the epilogue.
2828
class Body
@@ -57,15 +57,15 @@ def init_with(coder)
5757

5858
# Matches this body with another body. Also matches the decoded value of this
5959
# body with a string.
60-
#
60+
#
6161
# Examples:
62-
#
62+
#
6363
# body = Mail::Body.new('The body')
6464
# body == body #=> true
65-
#
65+
#
6666
# body = Mail::Body.new('The body')
6767
# body == 'The body' #=> true
68-
#
68+
#
6969
# body = Mail::Body.new("VGhlIGJvZHk=\n")
7070
# body.encoding = 'base64'
7171
# body == "The body" #=> true
@@ -76,28 +76,28 @@ def ==(other)
7676
super
7777
end
7878
end
79-
79+
8080
# Accepts a string and performs a regular expression against the decoded text
81-
#
81+
#
8282
# Examples:
83-
#
83+
#
8484
# body = Mail::Body.new('The body')
8585
# body =~ /The/ #=> 0
86-
#
86+
#
8787
# body = Mail::Body.new("VGhlIGJvZHk=\n")
8888
# body.encoding = 'base64'
8989
# body =~ /The/ #=> 0
9090
def =~(regexp)
9191
self.decoded =~ regexp
9292
end
93-
93+
9494
# Accepts a string and performs a regular expression against the decoded text
95-
#
95+
#
9696
# Examples:
97-
#
97+
#
9898
# body = Mail::Body.new('The body')
9999
# body.match(/The/) #=> #<MatchData "The">
100-
#
100+
#
101101
# body = Mail::Body.new("VGhlIGJvZHk=\n")
102102
# body.encoding = 'base64'
103103
# body.match(/The/) #=> #<MatchData "The">
@@ -125,7 +125,7 @@ def include?(other)
125125
def set_sort_order(order)
126126
@part_sort_order = order
127127
end
128-
128+
129129
# Allows you to sort the parts according to the default sort order, or the sort order you
130130
# set with :set_sort_order.
131131
#
@@ -137,7 +137,7 @@ def sort_parts!
137137
end
138138
@parts.sort!(@part_sort_order)
139139
end
140-
140+
141141
def negotiate_best_encoding(message_encoding, allowed_encodings = nil)
142142
Mail::Encodings::TransferEncoding.negotiate(message_encoding, encoding, raw_source, allowed_encodings)
143143
end
@@ -164,7 +164,7 @@ def encoded(transfer_encoding = nil)
164164
# Cannot decode, so skip normalization
165165
raw_source
166166
else
167-
# Decode then encode to normalize and allow transforming
167+
# Decode then encode to normalize and allow transforming
168168
# from base64 to Q-P and vice versa
169169
decoded = dec.decode(raw_source)
170170
if defined?(Encoding) && charset && charset != "US-ASCII"
@@ -183,7 +183,7 @@ def decoded
183183
Encodings.get_encoding(encoding).decode(raw_source)
184184
end
185185
end
186-
186+
187187
def to_s
188188
decoded
189189
end
@@ -289,11 +289,11 @@ def extract_parts
289289
end
290290
parts.map(&:first)
291291
end
292-
292+
293293
def crlf_boundary
294294
"\r\n--#{boundary}\r\n"
295295
end
296-
296+
297297
def end_boundary
298298
"\r\n--#{boundary}--\r\n"
299299
end

lib/mail/field_list.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# frozen_string_literal: true
33
module Mail
44

5-
# Field List class provides an enhanced array that keeps a list of
5+
# Field List class provides an enhanced array that keeps a list of
66
# email fields in order. And allows you to insert new fields without
77
# having to worry about the order they will appear in.
88
class FieldList < Array

lib/mail/mail.rb

+26-26
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,45 @@
33
module Mail
44

55
# Allows you to create a new Mail::Message object.
6-
#
6+
#
77
# You can make an email via passing a string or passing a block.
8-
#
8+
#
99
# For example, the following two examples will create the same email
1010
# message:
11-
#
11+
#
1212
# Creating via a string:
13-
#
13+
#
1414
# string = "To: [email protected]\r\n"
1515
# string << "From: [email protected]\r\n"
1616
# string << "Subject: This is an email\r\n"
1717
# string << "\r\n"
1818
# string << "This is the body"
1919
# Mail.new(string)
20-
#
20+
#
2121
# Or creating via a block:
22-
#
22+
#
2323
# message = Mail.new do
2424
2525
2626
# subject 'This is an email'
2727
# body 'This is the body'
2828
# end
29-
#
29+
#
3030
# Or creating via a hash (or hash like object):
31-
#
31+
#
3232
# message = Mail.new({:to => '[email protected]',
3333
# 'from' => '[email protected]',
3434
# :subject => 'This is an email',
3535
# :body => 'This is the body' })
36-
#
36+
#
3737
# Note, the hash keys can be strings or symbols, the passed in object
3838
# does not need to be a hash, it just needs to respond to :each_pair
3939
# and yield each key value pair.
40-
#
40+
#
4141
# As a side note, you can also create a new email through creating
4242
# a Mail::Message object directly and then passing in values via string,
4343
# symbol or direct method calls. See Mail::Message for more information.
44-
#
44+
#
4545
# mail = Mail.new
4646
# mail.to = '[email protected]'
4747
# mail[:from] = '[email protected]'
@@ -54,20 +54,20 @@ def self.new(*args, &block)
5454
# Sets the default delivery method and retriever method for all new Mail objects.
5555
# The delivery_method and retriever_method default to :smtp and :pop3, with defaults
5656
# set.
57-
#
57+
#
5858
# So sending a new email, if you have an SMTP server running on localhost is
5959
# as easy as:
60-
#
60+
#
6161
# Mail.deliver do
6262
6363
6464
# subject 'hi there!'
6565
# body 'this is a body'
6666
# end
67-
#
67+
#
6868
# If you do not specify anything, you will get the following equivalent code set in
6969
# every new mail object:
70-
#
70+
#
7171
# Mail.defaults do
7272
# delivery_method :smtp, { :address => "localhost",
7373
# :port => 25,
@@ -76,24 +76,24 @@ def self.new(*args, &block)
7676
# :password => nil,
7777
# :authentication => nil,
7878
# :enable_starttls_auto => true }
79-
#
79+
#
8080
# retriever_method :pop3, { :address => "localhost",
8181
# :port => 995,
8282
# :user_name => nil,
8383
# :password => nil,
8484
# :enable_ssl => true }
8585
# end
86-
#
86+
#
8787
# Mail.delivery_method.new #=> Mail::SMTP instance
8888
# Mail.retriever_method.new #=> Mail::POP3 instance
8989
#
9090
# Each mail object inherits the default set in Mail.delivery_method, however, on
9191
# a per email basis, you can override the method:
9292
#
9393
# mail.delivery_method :smtp
94-
#
94+
#
9595
# Or you can override the method and pass in settings:
96-
#
96+
#
9797
# mail.delivery_method :smtp, :address => 'some.host'
9898
def self.defaults(&block)
9999
Configuration.instance.instance_eval(&block)
@@ -112,21 +112,21 @@ def self.retriever_method
112112
# Send an email using the default configuration. You do need to set a default
113113
# configuration first before you use self.deliver, if you don't, an appropriate
114114
# error will be raised telling you to.
115-
#
115+
#
116116
# If you do not specify a delivery type, SMTP will be used.
117-
#
117+
#
118118
# Mail.deliver do
119119
120120
121121
# subject 'This is a test email'
122122
# body 'Not much to say here'
123123
# end
124-
#
124+
#
125125
# You can also do:
126-
#
126+
#
127127
# mail = Mail.read('email.eml')
128128
# mail.deliver!
129-
#
129+
#
130130
# And your email object will be created and sent.
131131
def self.deliver(*args, &block)
132132
mail = self.new(args, &block)
@@ -190,7 +190,7 @@ def Mail.connection(&block)
190190

191191
# You can register an object to be informed of every email that is sent through
192192
# this method.
193-
#
193+
#
194194
# Your object needs to respond to a single method #delivered_email(mail)
195195
# which receives the email that is sent.
196196
def self.register_observer(observer)
@@ -208,7 +208,7 @@ def self.unregister_observer(observer)
208208
# You can register an object to be given every mail object that will be sent,
209209
# before it is sent. So if you want to add special headers or modify any
210210
# email that gets sent through the Mail library, you can do so.
211-
#
211+
#
212212
# Your object needs to respond to a single method #delivering_email(mail)
213213
# which receives the email that is about to be sent. Make your modifications
214214
# directly to this object.

lib/mail/network/delivery_methods/file_delivery.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
module Mail
55
# FileDelivery class delivers emails into multiple files based on the destination
66
# address. Each file is appended to if it already exists.
7-
#
7+
#
88
# So if you have an email going to fred@test, bob@test, joe@anothertest, and you
99
# set your location path to /path/to/mails then FileDelivery will create the directory
1010
# if it does not exist, and put one copy of the email in three files, called
1111
# by their message id
12-
#
12+
#
1313
# Make sure the path you specify with :location is writable by the Ruby process
1414
# running Mail.
1515
class FileDelivery

lib/mail/network/delivery_methods/smtp.rb

+15-15
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33

44
module Mail
55
# == Sending Email with SMTP
6-
#
6+
#
77
# Mail allows you to send emails using SMTP. This is done by wrapping Net::SMTP in
88
# an easy to use manner.
9-
#
9+
#
1010
# === Sending via SMTP server on Localhost
11-
#
11+
#
1212
# Sending locally (to a postfix or sendmail server running on localhost) requires
1313
# no special setup. Just to Mail.deliver &block or message.deliver! and it will
1414
# be sent in this method.
15-
#
15+
#
1616
# === Sending via MobileMe
17-
#
17+
#
1818
# Mail.defaults do
1919
# delivery_method :smtp, { :address => "smtp.me.com",
2020
# :port => 587,
@@ -24,9 +24,9 @@ module Mail
2424
# :authentication => 'plain',
2525
# :enable_starttls_auto => true }
2626
# end
27-
#
27+
#
2828
# === Sending via GMail
29-
#
29+
#
3030
# Mail.defaults do
3131
# delivery_method :smtp, { :address => "smtp.gmail.com",
3232
# :port => 587,
@@ -48,30 +48,30 @@ module Mail
4848
# verify mode constant (OpenSSL::SSL::VERIFY_NONE, OpenSSL::SSL::VERIFY_PEER),
4949
# or a string containing the name of an OpenSSL verify mode (none, peer).
5050
#
51-
# === Others
52-
#
51+
# === Others
52+
#
5353
# Feel free to send me other examples that were tricky
54-
#
54+
#
5555
# === Delivering the email
56-
#
56+
#
5757
# Once you have the settings right, sending the email is done by:
58-
#
58+
#
5959
# Mail.deliver do
6060
6161
6262
# subject 'testing sendmail'
6363
# body 'testing sendmail'
6464
# end
65-
#
65+
#
6666
# Or by calling deliver on a Mail message
67-
#
67+
#
6868
# mail = Mail.new do
6969
7070
7171
# subject 'testing sendmail'
7272
# body 'testing sendmail'
7373
# end
74-
#
74+
#
7575
# mail.deliver!
7676
class SMTP
7777
attr_accessor :settings

0 commit comments

Comments
 (0)