Sha256: d60abd35615927da42a66d0f4e3b00fb14caa59596ec1f03ab676da0bc641652

Contents?: true

Size: 857 Bytes

Versions: 160

Compression:

Stored size: 857 Bytes

Contents

require 'abstract_controller/collector'
require 'active_support/core_ext/hash/reverse_merge'
require 'active_support/core_ext/array/extract_options'

module ActionMailer
  class Collector
    include AbstractController::Collector
    attr_reader :responses

    def initialize(context, &block)
      @context = context
      @responses = []
      @default_render = block
    end

    def any(*args, &block)
      options = args.extract_options!
      raise ArgumentError, "You have to supply at least one format" if args.empty?
      args.each { |type| send(type, options.dup, &block) }
    end
    alias :all :any

    def custom(mime, options = {})
      options.reverse_merge!(content_type: mime.to_s)
      @context.formats = [mime.to_sym]
      options[:body] = block_given? ? yield : @default_render.call
      @responses << options
    end
  end
end

Version data entries

160 entries across 155 versions & 11 rubygems

Version Path
actionmailer-4.1.14.1 lib/action_mailer/collector.rb
angular-rails4-templates-0.4.1 vendor/ruby/2.1.0/gems/actionmailer-4.2.4/lib/action_mailer/collector.rb
angular-rails4-templates-0.4.1 vendor/ruby/2.1.0/gems/actionmailer-4.1.13/lib/action_mailer/collector.rb
angular-rails4-templates-0.4.0 vendor/ruby/2.1.0/gems/actionmailer-4.1.13/lib/action_mailer/collector.rb
angular-rails4-templates-0.4.0 vendor/ruby/2.1.0/gems/actionmailer-4.2.4/lib/action_mailer/collector.rb
actionmailer-5.0.0.beta1 lib/action_mailer/collector.rb
angular-rails4-templates-0.3.0 vendor/ruby/2.1.0/gems/actionmailer-4.1.13/lib/action_mailer/collector.rb
angular-rails4-templates-0.3.0 vendor/ruby/2.1.0/gems/actionmailer-4.2.4/lib/action_mailer/collector.rb
actionmailer-4.1.14 lib/action_mailer/collector.rb
actionmailer-4.2.5 lib/action_mailer/collector.rb
actionmailer-4.2.5.rc2 lib/action_mailer/collector.rb
actionmailer-4.1.14.rc2 lib/action_mailer/collector.rb
actionmailer-4.2.5.rc1 lib/action_mailer/collector.rb
actionmailer-4.1.14.rc1 lib/action_mailer/collector.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/actionmailer-4.2.4/lib/action_mailer/collector.rb
actionmailer-4.2.4 lib/action_mailer/collector.rb
actionmailer-4.1.13 lib/action_mailer/collector.rb
actionmailer-4.2.4.rc1 lib/action_mailer/collector.rb
actionmailer-4.1.13.rc1 lib/action_mailer/collector.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/actionmailer-4.2.3/lib/action_mailer/collector.rb