diff options
Diffstat (limited to 'actionmailer/lib/action_mailer')
-rw-r--r-- | actionmailer/lib/action_mailer/base.rb | 11 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/collector.rb | 4 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/mail_helper.rb | 9 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/test_helper.rb | 2 |
4 files changed, 10 insertions, 16 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 7d8852f961..1800ff5839 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -1,7 +1,6 @@ require 'mail' require 'action_mailer/collector' require 'active_support/core_ext/object/blank' -require 'active_support/core_ext/proc' require 'active_support/core_ext/string/inflections' require 'active_support/core_ext/hash/except' require 'action_mailer/log_subscriber' @@ -409,7 +408,7 @@ module ActionMailer #:nodoc: # and passing a Mail::Message will do nothing except tell the logger you sent the email. def deliver_mail(mail) #:nodoc: ActiveSupport::Notifications.instrument("deliver.action_mailer") do |payload| - self.set_payload_for_mail(payload, mail) + set_payload_for_mail(payload, mail) yield # Let Mail do the delivery actions end end @@ -602,9 +601,6 @@ module ActionMailer #:nodoc: # end # def mail(headers={}, &block) - # Guard flag to prevent both the old and the new API from firing - # Should be removed when old API is removed - @mail_was_called = true m = @_message # At the beginning, do not consider class default for parts order neither content_type @@ -612,8 +608,9 @@ module ActionMailer #:nodoc: parts_order = headers[:parts_order] # Call all the procs (if any) - default_values = self.class.default.merge(self.class.default) do |k,v| - v.respond_to?(:call) ? v.bind(self).call : v + class_default = self.class.default + default_values = class_default.merge(class_default) do |k,v| + v.respond_to?(:to_proc) ? instance_eval(&v) : v end # Handle defaults diff --git a/actionmailer/lib/action_mailer/collector.rb b/actionmailer/lib/action_mailer/collector.rb index d03e085e83..17b22aea2a 100644 --- a/actionmailer/lib/action_mailer/collector.rb +++ b/actionmailer/lib/action_mailer/collector.rb @@ -22,9 +22,9 @@ module ActionMailer #:nodoc: def custom(mime, options={}) options.reverse_merge!(:content_type => mime.to_s) - @context.freeze_formats([mime.to_sym]) + @context.formats = [mime.to_sym] options[:body] = block_given? ? yield : @default_render.call @responses << options end end -end
\ No newline at end of file +end diff --git a/actionmailer/lib/action_mailer/mail_helper.rb b/actionmailer/lib/action_mailer/mail_helper.rb index 6f22adc479..2036883b22 100644 --- a/actionmailer/lib/action_mailer/mail_helper.rb +++ b/actionmailer/lib/action_mailer/mail_helper.rb @@ -1,11 +1,10 @@ module ActionMailer module MailHelper - # Uses Text::Format to take the text and format it, indented two spaces for - # each line, and wrapped at 72 columns. + # Take the text and format it, indented two spaces for each line, and wrapped at 72 columns. def block_format(text) - formatted = text.split(/\n\r\n/).collect { |paragraph| + formatted = text.split(/\n\r?\n/).collect { |paragraph| format_paragraph(paragraph) - }.join("\n") + }.join("\n\n") # Make list points stand on their own line formatted.gsub!(/[ ]*([*]+) ([^*]*)/) { |s| " #{$1} #{$2.strip}\n" } @@ -41,7 +40,7 @@ module ActionMailer sentences = [[]] text.split.each do |word| - if (sentences.last + [word]).join(' ').length > len + if sentences.first.present? && (sentences.last + [word]).join(' ').length > len sentences << [word] else sentences.last << word diff --git a/actionmailer/lib/action_mailer/test_helper.rb b/actionmailer/lib/action_mailer/test_helper.rb index 5beab87ad2..7204822395 100644 --- a/actionmailer/lib/action_mailer/test_helper.rb +++ b/actionmailer/lib/action_mailer/test_helper.rb @@ -1,7 +1,5 @@ module ActionMailer module TestHelper - extend ActiveSupport::Concern - # Asserts that the number of emails sent matches the given number. # # def test_emails |