diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-10-14 09:50:23 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-10-14 09:50:23 -0300 |
commit | 5da109d1050b9d9c95526332b9cdb603e53c05e1 (patch) | |
tree | bb52d9b8b16f548e316358d33583c6b610762e60 | |
parent | 06ad817f92e70449fb796af1b0d7cb42a1bac8f0 (diff) | |
parent | 7ec947d59c1bc3e9772788b757fe70f51b0ffd9b (diff) | |
download | rails-5da109d1050b9d9c95526332b9cdb603e53c05e1.tar.gz rails-5da109d1050b9d9c95526332b9cdb603e53c05e1.tar.bz2 rails-5da109d1050b9d9c95526332b9cdb603e53c05e1.zip |
Merge commit 'rails/master'
-rw-r--r-- | activesupport/lib/active_support/autoload.rb | 1 | ||||
-rw-r--r-- | activesupport/lib/active_support/callbacks.rb | 4 | ||||
-rw-r--r-- | activesupport/lib/active_support/concern.rb | 16 | ||||
-rw-r--r-- | activesupport/lib/active_support/dependency_module.rb | 17 | ||||
-rw-r--r-- | activesupport/lib/active_support/rescuable.rb | 8 |
5 files changed, 15 insertions, 31 deletions
diff --git a/activesupport/lib/active_support/autoload.rb b/activesupport/lib/active_support/autoload.rb index 71f4b395ce..47a17687bf 100644 --- a/activesupport/lib/active_support/autoload.rb +++ b/activesupport/lib/active_support/autoload.rb @@ -7,7 +7,6 @@ module ActiveSupport autoload :Callbacks, 'active_support/callbacks' autoload :Concern, 'active_support/concern' autoload :ConcurrentHash, 'active_support/concurrent_hash' - autoload :DependencyModule, 'active_support/dependency_module' autoload :DeprecatedCallbacks, 'active_support/deprecated_callbacks' autoload :Deprecation, 'active_support/deprecation' autoload :Gzip, 'active_support/gzip' diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index 21388d7a58..67e9b0103f 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -81,9 +81,7 @@ module ActiveSupport # saved # module Callbacks - def self.included(klass) - klass.extend ClassMethods - end + extend Concern def run_callbacks(kind, *args, &block) send("_run_#{kind}_callbacks", *args, &block) diff --git a/activesupport/lib/active_support/concern.rb b/activesupport/lib/active_support/concern.rb index dcf1e8152f..eb31f7cad4 100644 --- a/activesupport/lib/active_support/concern.rb +++ b/activesupport/lib/active_support/concern.rb @@ -1,11 +1,17 @@ -require 'active_support/dependency_module' - module ActiveSupport module Concern - include DependencyModule + def self.extended(base) + base.instance_variable_set("@_dependencies", []) + end def append_features(base) - if super + if base.instance_variable_defined?("@_dependencies") + base.instance_variable_get("@_dependencies") << self + return false + else + return false if base < self + @_dependencies.each { |dep| base.send(:include, dep) } + super base.extend const_get("ClassMethods") if const_defined?("ClassMethods") base.send :include, const_get("InstanceMethods") if const_defined?("InstanceMethods") base.class_eval(&@_included_block) if instance_variable_defined?("@_included_block") @@ -19,7 +25,5 @@ module ActiveSupport super end end - - alias_method :include, :depends_on end end diff --git a/activesupport/lib/active_support/dependency_module.rb b/activesupport/lib/active_support/dependency_module.rb deleted file mode 100644 index 6847c0f86a..0000000000 --- a/activesupport/lib/active_support/dependency_module.rb +++ /dev/null @@ -1,17 +0,0 @@ -module ActiveSupport - module DependencyModule - def append_features(base) - return false if base < self - (@_dependencies ||= []).each { |dep| base.send(:include, dep) } - super - end - - def depends_on(*mods) - mods.each do |mod| - next if self < mod - @_dependencies ||= [] - @_dependencies << mod - end - end - end -end diff --git a/activesupport/lib/active_support/rescuable.rb b/activesupport/lib/active_support/rescuable.rb index a7258c870a..879662c16c 100644 --- a/activesupport/lib/active_support/rescuable.rb +++ b/activesupport/lib/active_support/rescuable.rb @@ -4,11 +4,11 @@ require 'active_support/core_ext/proc' module ActiveSupport # Rescuable module adds support for easier exception handling. module Rescuable - def self.included(base) # :nodoc: - base.class_inheritable_accessor :rescue_handlers - base.rescue_handlers = [] + extend Concern - base.extend(ClassMethods) + included do + class_inheritable_accessor :rescue_handlers + self.rescue_handlers = [] end module ClassMethods |