Class: ActionMailer::Collector
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
|
|
Inherits: | Object |
Defined in: | actionmailer/lib/action_mailer/collector.rb |
Class Method Summary
- .new(context, &block) ⇒ Collector constructor
Instance Attribute Summary
- #responses readonly
Instance Method Summary
-
#all(*args, &block)
Alias for #any.
- #any(*args, &block) (also: #all)
- #custom(mime, options = {})
Constructor Details
.new(context, &block) ⇒ Collector
# File 'actionmailer/lib/action_mailer/collector.rb', line 12
def initialize(context, &block) @context = context @responses = [] @default_render = block end
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class AbstractController::Collector
Instance Attribute Details
#responses (readonly)
[ GitHub ]# File 'actionmailer/lib/action_mailer/collector.rb', line 10
attr_reader :responses
Instance Method Details
#all(*args, &block)
Alias for #any.
# File 'actionmailer/lib/action_mailer/collector.rb', line 23
alias :all :any
#any(*args, &block) Also known as: #all
# File 'actionmailer/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 = {})
[ GitHub ]# File 'actionmailer/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