Permalink
Browse files

Merge commit 'rails/master'

  • Loading branch information...
2 parents 06ad817 + 7ec947d commit 5da109d1050b9d9c95526332b9cdb603e53c05e1 @miloops miloops committed Oct 14, 2009
@@ -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'
@@ -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)
@@ -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 @@ def included(base = nil, &block)
super
end
end
-
- alias_method :include, :depends_on
end
end
@@ -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
@@ -4,11 +4,11 @@
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

0 comments on commit 5da109d

Please sign in to comment.