aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/class
diff options
context:
space:
mode:
authorYehuda Katz <wycats@yehuda-katzs-macbookpro41.local>2009-06-02 19:00:59 -0700
committerYehuda Katz <wycats@yehuda-katzs-macbookpro41.local>2009-06-02 19:00:59 -0700
commit971e2438d98326c994ec6d3ef8e37b7e868ed6e2 (patch)
tree3a746ec6e845b7956775055a1a2453bd46eb6eb4 /activesupport/lib/active_support/core_ext/class
parent196f780e30fcece25e4d09c12f9b9f7374ebed29 (diff)
downloadrails-971e2438d98326c994ec6d3ef8e37b7e868ed6e2.tar.gz
rails-971e2438d98326c994ec6d3ef8e37b7e868ed6e2.tar.bz2
rails-971e2438d98326c994ec6d3ef8e37b7e868ed6e2.zip
Simplify callbacks to use less metaprogramming
Diffstat (limited to 'activesupport/lib/active_support/core_ext/class')
-rw-r--r--activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb6
1 files changed, 4 insertions, 2 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 cca93a0b9f..8bac2dff19 100644
--- a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
+++ b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
@@ -202,6 +202,8 @@ class Class
def #{ivar}=(obj) self.class.#{ivar} = obj end
RUBY
end
+
+ self.send("#{ivar}=", yield) if block_given?
end
end
@@ -214,8 +216,8 @@ class Class
# @return <Array[#to_s]> An Array of attributes turned into inheritable accessors.
#
# @api public
- def extlib_inheritable_accessor(*syms)
+ def extlib_inheritable_accessor(*syms, &block)
extlib_inheritable_reader(*syms)
- extlib_inheritable_writer(*syms)
+ extlib_inheritable_writer(*syms, &block)
end
end