Created
May 13, 2009 13:45
-
-
Save rnaveiras/111017 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActiveSupport | |
module DependencyModule | |
def append_features(base) | |
return 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(mod) | |
return if self < mod | |
@_dependencies ||= [] | |
@_dependencies << mod | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment