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