Flowdock
method

adv_attr_accessor

Importance_0
v3.1.0 - Show latest stable - 0 notes - Class: ActionMailer::AdvAttrAccessor
adv_attr_accessor(name, deprecation=nil) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actionmailer/lib/action_mailer/adv_attr_accessor.rb, line 3
    def adv_attr_accessor(name, deprecation=nil)
      ivar = "@#{name}"
      deprecation ||= "Please pass :#{name} as hash key to mail() instead"

      class_eval         def #{name}=(value)          ActiveSupport::Deprecation.warn "#{name}= is deprecated. #{deprecation}"          #{ivar} = value        end        def #{name}(*args)          raise ArgumentError, "expected 0 or 1 parameters" unless args.length <= 1          if args.empty?            ActiveSupport::Deprecation.warn "#{name}() is deprecated and will be removed in future versions."            #{ivar} if instance_variable_names.include?(#{ivar.inspect})          else            ActiveSupport::Deprecation.warn "#{name}(value) is deprecated. #{deprecation}"            #{ivar} = args.first          end        end, __FILE__, __LINE__ + 1

      self.protected_instance_variables << ivar if self.respond_to?(:protected_instance_variables)
    end
Register or log in to add new notes.