blob: 49c3f04badff7afdcba920bd7105256b9e0f366f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
require 'abstract_controller/collector'
module ActionMailer #:nodoc:
class Collector
include AbstractController::Collector
attr_accessor :responses
def initialize(context, options, &block)
@default_options = options
@default_render = block
@default_formats = context.formats
@context = context
@responses = []
end
def custom(mime, options={}, &block)
options = @default_options.merge(:content_type => mime.to_s).merge(options)
@context.formats = [mime.to_sym]
options[:body] = if block
block.call
else
@default_render.call
end
@responses << options
@context.formats = @default_formats
end
end
end
|