diff options
author | Michael S. Klishin <michael@novemberain.com> | 2008-12-28 13:21:10 +0300 |
---|---|---|
committer | Michael S. Klishin <michael@novemberain.com> | 2008-12-28 13:21:10 +0300 |
commit | d77deb89d54b18c662ae3de103802e4d7a9d7d08 (patch) | |
tree | f5a77220f9057d3b998e1a2db8166ecc021e32cc /activesupport/lib/active_support/core_ext/module | |
parent | 5da3ba12159d2c4fc0680efcf0cad8a31f725122 (diff) | |
download | rails-d77deb89d54b18c662ae3de103802e4d7a9d7d08.tar.gz rails-d77deb89d54b18c662ae3de103802e4d7a9d7d08.tar.bz2 rails-d77deb89d54b18c662ae3de103802e4d7a9d7d08.zip |
Annotated metaprogramming code across ActiveSupport
Diffstat (limited to 'activesupport/lib/active_support/core_ext/module')
-rw-r--r-- | activesupport/lib/active_support/core_ext/module/attribute_accessors.rb | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb b/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb index 51e1c9af90..9467eb71ac 100644 --- a/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb +++ b/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb @@ -14,18 +14,18 @@ class Module def mattr_reader(*syms) syms.each do |sym| next if sym.is_a?(Hash) - class_eval(<<-EOS, __FILE__, __LINE__) - unless defined? @@#{sym} - @@#{sym} = nil - end + class_eval(<<-EOS, __FILE__, __LINE__ + 1) + unless defined? @@#{sym} # unless defined? @@property + @@#{sym} = nil # @@ property = nil + end # end - def self.#{sym} - @@#{sym} - end + def self.#{sym} # def self.property + @@#{sym} # @@property + end # end - def #{sym} - @@#{sym} - end + def #{sym} # def property + @@#{sym} # @@property + end # end EOS end end @@ -33,19 +33,19 @@ class Module def mattr_writer(*syms) options = syms.extract_options! syms.each do |sym| - class_eval(<<-EOS, __FILE__, __LINE__) - unless defined? @@#{sym} - @@#{sym} = nil - end - - def self.#{sym}=(obj) - @@#{sym} = obj - end - - #{" - def #{sym}=(obj) - @@#{sym} = obj - end + class_eval(<<-EOS, __FILE__, __LINE__ + 1) + unless defined? @@#{sym} # unless defined? @@property + @@#{sym} = nil # @@ property = nil + end # end + + def self.#{sym}=(obj) # def self.property=(obj) + @@#{sym} = obj # @@property = obj + end # end + + #{" + def #{sym}=(obj) # def property=(obj) + @@#{sym} = obj # @@property = obj + end # end " unless options[:instance_writer] == false } EOS end |