aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer
diff options
context:
space:
mode:
authorRobin Dupret <robin.dupret@gmail.com>2015-03-02 13:10:30 +0100
committerRobin Dupret <robin.dupret@gmail.com>2015-03-02 13:10:30 +0100
commit9f4210cd80f452685b44c198d5a361ee2b54c05e (patch)
tree7333ab79718da887dc9282c2f82b0ee0fab2978f /actionmailer
parent565bf8926e48151cb3168073132bc6016f46b32e (diff)
parent435aa7e34f411ea9802345da9a1cfa04bd4deabf (diff)
downloadrails-9f4210cd80f452685b44c198d5a361ee2b54c05e.tar.gz
rails-9f4210cd80f452685b44c198d5a361ee2b54c05e.tar.bz2
rails-9f4210cd80f452685b44c198d5a361ee2b54c05e.zip
Merge pull request #19133 from davydovanton/update-doc-example-mail-block-format
[ci skip] Add code example for MailHelper#block_format documentation
Diffstat (limited to 'actionmailer')
-rw-r--r--actionmailer/lib/action_mailer/mail_helper.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/actionmailer/lib/action_mailer/mail_helper.rb b/actionmailer/lib/action_mailer/mail_helper.rb
index 227192f48d..239974e7b1 100644
--- a/actionmailer/lib/action_mailer/mail_helper.rb
+++ b/actionmailer/lib/action_mailer/mail_helper.rb
@@ -4,7 +4,17 @@ module ActionMailer
# attachments list.
module MailHelper
# Take the text and format it, indented two spaces for each line, and
- # wrapped at 72 columns.
+ # wrapped at 72 columns:
+ #
+ # text = <<-TEXT
+ # This is
+ # the paragraph.
+ #
+ # * item1 * item2
+ # TEXT
+ #
+ # block_format text
+ # # => " This is the paragraph.\n\n * item1\n * item2\n"
def block_format(text)
formatted = text.split(/\n\r?\n/).collect { |paragraph|
format_paragraph(paragraph)