diff options
author | Michael S. Klishin <michael@novemberain.com> | 2008-12-28 23:47:29 +0300 |
---|---|---|
committer | Michael S. Klishin <michael@novemberain.com> | 2008-12-28 23:47:29 +0300 |
commit | 2b8750eba439c4b829b2e8172a1edc0dfa9c532b (patch) | |
tree | 1ea12e7fe5ad299119d801c7e7f527f6b7780bc3 /activesupport/lib/active_support/core_ext/class/attribute_accessors.rb | |
parent | e523b43e202d343912f67b8c8737d9e2e956b31f (diff) | |
parent | 0efec64520d5153e5a961f9a759883656b83bb53 (diff) | |
download | rails-2b8750eba439c4b829b2e8172a1edc0dfa9c532b.tar.gz rails-2b8750eba439c4b829b2e8172a1edc0dfa9c532b.tar.bz2 rails-2b8750eba439c4b829b2e8172a1edc0dfa9c532b.zip |
Sync with rails/rails/master, merge two metaprogramming annotation efforts
Diffstat (limited to 'activesupport/lib/active_support/core_ext/class/attribute_accessors.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/class/attribute_accessors.rb | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb b/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb index 6b2ac8b38b..75e481fc54 100644 --- a/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb +++ b/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb @@ -11,17 +11,17 @@ class Class syms.flatten.each do |sym| next if sym.is_a?(Hash) class_eval(<<-EOS, __FILE__, __LINE__ + 1) - unless defined? @@#{sym} # unless defined @@property - @@#{sym} = nil # @@property = nil - end # end - - def self.#{sym} # def self.property - @@#{sym} # @@property - end # end - - def #{sym} # def property - @@#{sym} # @@property - end # end + unless defined? @@#{sym} # unless defined? @@hair_colors + @@#{sym} = nil # @@hair_colors = nil + end # end + # + def self.#{sym} # def self.hair_colors + @@#{sym} # @@hair_colors + end # end + # + def #{sym} # def hair_colors + @@#{sym} # @@hair_colors + end # end EOS end end @@ -30,19 +30,19 @@ class Class options = syms.extract_options! syms.flatten.each do |sym| 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 - end # end - - #{" - def #{sym}=(obj) # def property=(obj) - @@#{sym} = obj # @@property = obj - end # end - " unless options[:instance_writer] == false } + unless defined? @@#{sym} # unless defined? @@hair_colors + @@#{sym} = nil # @@hair_colors = nil + end # end + # + def self.#{sym}=(obj) # def self.hair_colors=(obj) + @@#{sym} = obj # @@hair_colors = obj + end # end + # + #{" # + def #{sym}=(obj) # def hair_colors=(obj) + @@#{sym} = obj # @@hair_colors = obj + end # end + " unless options[:instance_writer] == false } # # instance writer above is generated unless options[:instance_writer] == false EOS end end |