Created
November 14, 2008 17:47
-
-
Save joefiorini/25023 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
has_behavior :supports_groups_and_categories | |
def has_behavior(behavior) | |
mod = behavior.to_s.camelize.constantize | |
class << mod | |
def class_methods | |
mod::ClassMethods | |
end | |
def instance_methods | |
mod::InstanceMethods | |
end | |
end | |
include mod.instance_methods | |
extend mod.class_methods | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment