diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-05-07 10:38:57 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-05-07 10:38:57 -0500 |
commit | af40fa6d036d86895e7be4ef46a615d44eb41ede (patch) | |
tree | 481cd4d0aaf724833ce4c97fcaaf56aa8e109891 /activesupport/lib/active_support/dependency_module.rb | |
parent | 2854535b02bcee3668bda02c76c3105fc24730d3 (diff) | |
download | rails-af40fa6d036d86895e7be4ef46a615d44eb41ede.tar.gz rails-af40fa6d036d86895e7be4ef46a615d44eb41ede.tar.bz2 rails-af40fa6d036d86895e7be4ef46a615d44eb41ede.zip |
Prefer "included" language over "setup"
Diffstat (limited to 'activesupport/lib/active_support/dependency_module.rb')
-rw-r--r-- | activesupport/lib/active_support/dependency_module.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/activesupport/lib/active_support/dependency_module.rb b/activesupport/lib/active_support/dependency_module.rb index 0e1cc67b53..c690b49a2b 100644 --- a/activesupport/lib/active_support/dependency_module.rb +++ b/activesupport/lib/active_support/dependency_module.rb @@ -1,18 +1,18 @@ module ActiveSupport module DependencyModule - def setup(&blk) - @_setup_block = blk - end - def append_features(base) return if base < self (@_dependencies ||= []).each { |dep| base.send(:include, dep) } super end - def included(base) - base.extend const_get("ClassMethods") if const_defined?("ClassMethods") - base.class_eval(&@_setup_block) if instance_variable_defined?("@_setup_block") + def included(base = nil, &block) + if base.nil? && block_given? + @_included_block = block + else + base.extend const_get("ClassMethods") if const_defined?("ClassMethods") + base.class_eval(&@_included_block) if instance_variable_defined?("@_included_block") + end end def depends_on(mod) |