aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
diff options
context:
space:
mode:
authorMichael S. Klishin <michael@novemberain.com>2008-12-28 23:47:29 +0300
committerMichael S. Klishin <michael@novemberain.com>2008-12-28 23:47:29 +0300
commit2b8750eba439c4b829b2e8172a1edc0dfa9c532b (patch)
tree1ea12e7fe5ad299119d801c7e7f527f6b7780bc3 /activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
parente523b43e202d343912f67b8c8737d9e2e956b31f (diff)
parent0efec64520d5153e5a961f9a759883656b83bb53 (diff)
downloadrails-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/inheritable_attributes.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb54
1 files changed, 27 insertions, 27 deletions
diff --git a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
index 8d0233ce9a..70fdde3a58 100644
--- a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
+++ b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
@@ -26,15 +26,15 @@ class Class # :nodoc:
options = syms.extract_options!
syms.each do |sym|
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
- def self.#{sym}=(obj) # def self.property=(obj)
- write_inheritable_attribute(:#{sym}, obj) # write_inheritable_attribute(:property, obj)
- end # end
-
- #{"
- def #{sym}=(obj) # def property=(obj)
- self.class.#{sym} = obj # self.class.property = obj
- end # end
- " unless options[:instance_writer] == false }
+ def self.#{sym}=(obj) # def self.color=(obj)
+ write_inheritable_attribute(:#{sym}, obj) # write_inheritable_attribute(:color, obj)
+ end # end
+ #
+ #{" #
+ def #{sym}=(obj) # def color=(obj)
+ self.class.#{sym} = obj # self.class.color = obj
+ end # end
+ " unless options[:instance_writer] == false } # # the writer above is generated unless options[:instance_writer] == false
EOS
end
end
@@ -43,15 +43,15 @@ class Class # :nodoc:
options = syms.extract_options!
syms.each do |sym|
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
- def self.#{sym}=(obj) # def self.property=(obj)
- write_inheritable_array(:#{sym}, obj) # write_inheritable_array(:property, obj)
- end # end
-
- #{"
- def #{sym}=(obj) # def property=(obj)
- self.class.#{sym} = obj # self.class.property = obj
- end # end
- " unless options[:instance_writer] == false }
+ def self.#{sym}=(obj) # def self.levels=(obj)
+ write_inheritable_array(:#{sym}, obj) # write_inheritable_array(:levels, obj)
+ end # end
+ #
+ #{" #
+ def #{sym}=(obj) # def levels=(obj)
+ self.class.#{sym} = obj # self.class.levels = obj
+ end # end
+ " unless options[:instance_writer] == false } # # the writer above is generated unless options[:instance_writer] == false
EOS
end
end
@@ -60,15 +60,15 @@ class Class # :nodoc:
options = syms.extract_options!
syms.each do |sym|
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
- def self.#{sym}=(obj) # def self.property=(obj)
- write_inheritable_hash(:#{sym}, obj) # write_inheritable_hash(:property, obj)
- end # end
-
- #{"
- def #{sym}=(obj) # def property=(obj)
- self.class.#{sym} = obj # self.class.property = obj
- end # end
- " unless options[:instance_writer] == false }
+ def self.#{sym}=(obj) # def self.nicknames=(obj)
+ write_inheritable_hash(:#{sym}, obj) # write_inheritable_hash(:nicknames, obj)
+ end # end
+ #
+ #{" #
+ def #{sym}=(obj) # def nicknames=(obj)
+ self.class.#{sym} = obj # self.class.nicknames = obj
+ end # end
+ " unless options[:instance_writer] == false } # # the writer above is generated unless options[:instance_writer] == false
EOS
end
end