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.



450
451
452
# File 'lib/action_mailer/base.rb', line 450

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



471
472
473
# File 'lib/action_mailer/base.rb', line 471

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

Instance Method Details

#[]=(key, value) ⇒ Object



454
455
456
457
458
459
460
461
462
463
# File 'lib/action_mailer/base.rb', line 454

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



465
466
467
468
469
# File 'lib/action_mailer/base.rb', line 465

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