1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

[ci skip] Add code example for MailHelper#block_format documentation

This commit is contained in:
Anton Davydov 2015-02-28 23:24:59 +03:00
parent daa455f5ca
commit 435aa7e34f

View file

@ -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)