Sha256: 4ce6a4599b61199b27842947460b4624a9a0d727453c62cd0a237e7765debca0

Contents?: true

Size: 791 Bytes

Versions: 91

Compression:

Stored size: 791 Bytes

Contents

module ActionMailer
  module AdvAttrAccessor #:nodoc:
    def self.included(base)
      base.extend(ClassMethods)
    end

    module ClassMethods #:nodoc:
      def adv_attr_accessor(*names)
        names.each do |name|
          ivar = "@#{name}"

          define_method("#{name}=") do |value|
            instance_variable_set(ivar, value)
          end

          define_method(name) do |*parameters|
            raise ArgumentError, "expected 0 or 1 parameters" unless parameters.length <= 1
            if parameters.empty?
              if instance_variables.include?(ivar)
                instance_variable_get(ivar)
              end
            else
              instance_variable_set(ivar, parameters.first)
            end
          end
        end
      end
    end
  end
end

Version data entries

91 entries across 91 versions & 6 rubygems

Version Path
jstorimer-deep-test-2.0.0 sample_rails_project/vendor/rails/actionmailer/lib/action_mailer/adv_attr_accessor.rb
jstorimer-deep-test-1.4.0 sample_rails_project/vendor/rails/actionmailer/lib/action_mailer/adv_attr_accessor.rb
jstorimer-deep-test-1.3.0 sample_rails_project/vendor/rails/actionmailer/lib/action_mailer/adv_attr_accessor.rb
jstorimer-deep-test-1.2.0 sample_rails_project/vendor/rails/actionmailer/lib/action_mailer/adv_attr_accessor.rb
jstorimer-deep-test-1.1.0 sample_rails_project/vendor/rails/actionmailer/lib/action_mailer/adv_attr_accessor.rb
jstorimer-deep-test-1.0.0 sample_rails_project/vendor/rails/actionmailer/lib/action_mailer/adv_attr_accessor.rb
jstorimer-deep-test-0.2.0 sample_rails_project/vendor/rails/actionmailer/lib/action_mailer/adv_attr_accessor.rb
jstorimer-deep-test-0.1.0 sample_rails_project/vendor/rails/actionmailer/lib/action_mailer/adv_attr_accessor.rb
actionmailer-1.3.5 lib/action_mailer/adv_attr_accessor.rb
actionmailer-2.0.1 lib/action_mailer/adv_attr_accessor.rb
actionmailer-2.0.2 lib/action_mailer/adv_attr_accessor.rb
actionmailer-1.3.1 lib/action_mailer/adv_attr_accessor.rb
actionmailer-2.0.4 lib/action_mailer/adv_attr_accessor.rb
actionmailer-1.3.0 lib/action_mailer/adv_attr_accessor.rb
actionmailer-1.3.2 lib/action_mailer/adv_attr_accessor.rb
actionmailer-1.3.3 lib/action_mailer/adv_attr_accessor.rb
actionmailer-1.3.6 lib/action_mailer/adv_attr_accessor.rb
actionmailer-2.0.0 lib/action_mailer/adv_attr_accessor.rb
actionmailer-1.3.4 lib/action_mailer/adv_attr_accessor.rb
actionmailer-2.0.5 lib/action_mailer/adv_attr_accessor.rb