Class: ActionMailer::Collector
- Inherits:
-
Object
- Object
- ActionMailer::Collector
- Includes:
- AbstractController::Collector
- Defined in:
- lib/action_mailer/collector.rb
Instance Attribute Summary collapse
-
#responses ⇒ Object
readonly
Returns the value of attribute responses.
Instance Method Summary collapse
- #any(*args, &block) ⇒ Object (also: #all)
- #custom(mime, options = {}) ⇒ Object
-
#initialize(context, &block) ⇒ Collector
constructor
A new instance of Collector.
Constructor Details
#initialize(context, &block) ⇒ Collector
Returns a new instance of Collector.
12 13 14 15 16 |
# File 'lib/action_mailer/collector.rb', line 12 def initialize(context, &block) @context = context @responses = [] @default_render = block end |
Instance Attribute Details
#responses ⇒ Object (readonly)
Returns the value of attribute responses.
10 11 12 |
# File 'lib/action_mailer/collector.rb', line 10 def responses @responses end |
Instance Method Details
#any(*args, &block) ⇒ Object Also known as: all
18 19 20 21 22 |
# File 'lib/action_mailer/collector.rb', line 18 def any(*args, &block) = args. raise ArgumentError, "You have to supply at least one format" if args.empty? args.each { |type| send(type, .dup, &block) } end |
#custom(mime, options = {}) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/action_mailer/collector.rb', line 25 def custom(mime, = {}) .reverse_merge!(content_type: mime.to_s) @context.formats = [mime.to_sym] [:body] = block_given? ? yield : @default_render.call @responses << end |