diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-06-01 06:32:16 -0300 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-06-01 12:06:47 +0200 |
commit | 0cc4cd020da024674b5cf20ab23ff7498bc55f4a (patch) | |
tree | 800663182ba1a19104d1c806a443f7d937108d8d /actionmailer/lib/action_mailer/mail_helper.rb | |
parent | 57144388f0b4c31e43ced7cfd1d6efaded88cf5e (diff) | |
download | rails-0cc4cd020da024674b5cf20ab23ff7498bc55f4a.tar.gz rails-0cc4cd020da024674b5cf20ab23ff7498bc55f4a.tar.bz2 rails-0cc4cd020da024674b5cf20ab23ff7498bc55f4a.zip |
Unforce text-format from AM
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionmailer/lib/action_mailer/mail_helper.rb')
-rw-r--r-- | actionmailer/lib/action_mailer/mail_helper.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/actionmailer/lib/action_mailer/mail_helper.rb b/actionmailer/lib/action_mailer/mail_helper.rb index ab5c3469b2..aab6e12387 100644 --- a/actionmailer/lib/action_mailer/mail_helper.rb +++ b/actionmailer/lib/action_mailer/mail_helper.rb @@ -3,6 +3,13 @@ module ActionMailer # Uses Text::Format to take the text and format it, indented two spaces for # each line, and wrapped at 72 columns. def block_format(text) + begin + require 'text/format' + rescue LoadError => e + $stderr.puts "You don't have text-format installed in your application. Please add it to your Gemfile and run bundle install" + raise e + end unless defined?(Text::Format) + formatted = text.split(/\n\r\n/).collect { |paragraph| Text::Format.new( :columns => 72, :first_indent => 2, :body_indent => 2, :text => paragraph |