Sha256: 805d2b0388d19421505cf5fdeed101d235a48d47f90c274d3154a00828ec652e
Contents?: true
Size: 796 Bytes
Versions: 85
Compression:
Stored size: 796 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_variable_names.include?(ivar) instance_variable_get(ivar) end else instance_variable_set(ivar, parameters.first) end end end end end end end
Version data entries
85 entries across 82 versions & 16 rubygems