Skip to content

Commit

Permalink
It's not needed to initialize the attr when calling mattr_writer
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino authored and tenderlove committed Jul 17, 2010
1 parent 7aec9f9 commit cebe5c2
Showing 1 changed file with 1 addition and 7 deletions.
Expand Up @@ -5,9 +5,7 @@ def mattr_reader(*syms)
options = syms.extract_options!
syms.each do |sym|
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
unless defined? @@#{sym}
@@#{sym} = nil
end
@@#{sym} = nil unless defined? @@#{sym}
def self.#{sym}
@@#{sym}
Expand All @@ -28,10 +26,6 @@ def mattr_writer(*syms)
options = syms.extract_options!
syms.each do |sym|
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
unless defined? @@#{sym}
@@#{sym} = nil
end
def self.#{sym}=(obj)
@@#{sym} = obj
end
Expand Down

0 comments on commit cebe5c2

Please sign in to comment.