aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/autoload.rb3
-rw-r--r--activesupport/lib/active_support/concern.rb22
-rw-r--r--activesupport/lib/active_support/dependency_module.rb12
3 files changed, 25 insertions, 12 deletions
diff --git a/activesupport/lib/active_support/autoload.rb b/activesupport/lib/active_support/autoload.rb
index ed229d1c5f..75706855d6 100644
--- a/activesupport/lib/active_support/autoload.rb
+++ b/activesupport/lib/active_support/autoload.rb
@@ -5,7 +5,7 @@ module ActiveSupport
autoload :BufferedLogger, 'active_support/buffered_logger'
autoload :Cache, 'active_support/cache'
autoload :Callbacks, 'active_support/callbacks'
- autoload :NewCallbacks, 'active_support/new_callbacks'
+ autoload :Concern, 'active_support/concern'
autoload :ConcurrentHash, 'active_support/concurrent_hash'
autoload :DependencyModule, 'active_support/dependency_module'
autoload :Deprecation, 'active_support/deprecation'
@@ -15,6 +15,7 @@ module ActiveSupport
autoload :MessageEncryptor, 'active_support/message_encryptor'
autoload :MessageVerifier, 'active_support/message_verifier'
autoload :Multibyte, 'active_support/multibyte'
+ autoload :NewCallbacks, 'active_support/new_callbacks'
autoload :OptionMerger, 'active_support/option_merger'
autoload :OrderedHash, 'active_support/ordered_hash'
autoload :OrderedOptions, 'active_support/ordered_options'
diff --git a/activesupport/lib/active_support/concern.rb b/activesupport/lib/active_support/concern.rb
new file mode 100644
index 0000000000..154f8807f7
--- /dev/null
+++ b/activesupport/lib/active_support/concern.rb
@@ -0,0 +1,22 @@
+require 'active_support/dependency_module'
+
+module ActiveSupport
+ module Concern
+ include DependencyModule
+
+ def append_features(base)
+ if super
+ base.extend const_get("ClassMethods") if const_defined?("ClassMethods")
+ base.class_eval(&@_included_block) if instance_variable_defined?("@_included_block")
+ end
+ end
+
+ def included(base = nil, &block)
+ if base.nil?
+ @_included_block = block
+ else
+ super
+ end
+ end
+ end
+end
diff --git a/activesupport/lib/active_support/dependency_module.rb b/activesupport/lib/active_support/dependency_module.rb
index 9872b9654b..6847c0f86a 100644
--- a/activesupport/lib/active_support/dependency_module.rb
+++ b/activesupport/lib/active_support/dependency_module.rb
@@ -1,19 +1,9 @@
module ActiveSupport
module DependencyModule
def append_features(base)
- return if base < self
+ return false if base < self
(@_dependencies ||= []).each { |dep| base.send(:include, dep) }
super
- base.extend const_get("ClassMethods") if const_defined?("ClassMethods")
- base.class_eval(&@_included_block) if instance_variable_defined?("@_included_block")
- end
-
- def included(base = nil, &block)
- if base.nil?
- @_included_block = block
- else
- super
- end
end
def depends_on(*mods)