Created
August 24, 2008 18:15
-
-
Save jcoglan/6999 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
class Module | |
method = instance_method(:instance_methods) | |
define_method :instance_methods do |condition = true| | |
return method.bind(self).call(condition) unless Module === condition | |
anc = ancestors | |
index = anc.index(condition) || -1 | |
anc[0..index].inject([]) { |methods, ancestor| | |
methods.concat(ancestor.instance_methods(false)) | |
}.uniq | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment