diff options
Diffstat (limited to 'actionmailer/lib/action_mailer/mail_helper.rb')
-rw-r--r-- | actionmailer/lib/action_mailer/mail_helper.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/actionmailer/lib/action_mailer/mail_helper.rb b/actionmailer/lib/action_mailer/mail_helper.rb index 887c7012d9..6f22adc479 100644 --- a/actionmailer/lib/action_mailer/mail_helper.rb +++ b/actionmailer/lib/action_mailer/mail_helper.rb @@ -4,7 +4,7 @@ module ActionMailer # each line, and wrapped at 72 columns. def block_format(text) formatted = text.split(/\n\r\n/).collect { |paragraph| - simple_format(paragraph) + format_paragraph(paragraph) }.join("\n") # Make list points stand on their own line @@ -29,8 +29,15 @@ module ActionMailer @_message.attachments end - private - def simple_format(text, len = 72, indent = 2) + # Returns +text+ wrapped at +len+ columns and indented +indent+ spaces. + # + # === Examples + # + # my_text = "Here is a sample text with more than 40 characters" + # + # format_paragraph(my_text, 25, 4) + # # => " Here is a sample text with\n more than 40 characters" + def format_paragraph(text, len = 72, indent = 2) sentences = [[]] text.split.each do |word| |