Class: ActionMailer::Base::DeprecatedHeaderProxy

Inherits:
ActiveSupport::BasicObject
Defined in:
lib/action_mailer/base.rb

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ DeprecatedHeaderProxy

Returns a new instance of DeprecatedHeaderProxy.



475
476
477
# File 'lib/action_mailer/base.rb', line 475

def initialize(message)
  @message = message
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object



496
497
498
# File 'lib/action_mailer/base.rb', line 496

def method_missing(meth, *args, &block)
  @message.send(meth, *args, &block)
end

Instance Method Details

#[]=(key, value) ⇒ Object



479
480
481
482
483
484
485
486
487
488
# File 'lib/action_mailer/base.rb', line 479

def []=(key, value)
  unless value.is_a?(::String)
    ::ActiveSupport::Deprecation.warn("Using a non-String object for a header's value is deprecated. " \
      "You specified #{value.inspect} (a #{value.class}) for #{key}", caller)

    value = value.to_s
  end

  @message[key] = value
end

#headers(hash = {}) ⇒ Object



490
491
492
493
494
# File 'lib/action_mailer/base.rb', line 490

def headers(hash = {})
  hash.each_pair do |k,v|
    self[k] = v
  end
end