Methods
Public Instance methods
Uses Text::Format to take the text and format it, indented two spaces for each line, and wrapped at 72 columns.
[ show source ]
# File lib/action_mailer/mail_helper.rb, line 6
6: def block_format(text)
7: formatted = text.split(/\n\r\n/).collect { |paragraph|
8: Text::Format.new(
9: :columns => 72, :first_indent => 2, :body_indent => 2, :text => paragraph
10: ).format
11: }.join("\n")
12:
13: # Make list points stand on their own line
14: formatted.gsub!(/[ ]*([*]+) ([^*]*)/) { |s| " #{$1} #{$2.strip}\n" }
15: formatted.gsub!(/[ ]*([#]+) ([^#]*)/) { |s| " #{$1} #{$2.strip}\n" }
16:
17: formatted
18: end