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