Created
June 3, 2012 17:09
-
-
Save wanabe/2864174 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
Index: tools/bc-methods.rb | |
=================================================================== | |
--- tools/bc-methods.rb (revision 5176) | |
+++ tools/bc-methods.rb (working copy) | |
@@ -158,10 +158,11 @@ def defined_methods(ruby, classname) | |
c.singleton_methods(false).each do |m| | |
puts "#{classname}.\#{m}" | |
end | |
+ opt = Kernel.method(:const_defined?).arity == 1 ? [] : [false] | |
c.instance_methods(false).each do |m| | |
puts "#{classname}\\#\#{m}" | |
end | |
- c.ancestors.map {|mod| mod.constants }.inject {|r,n| r-n }.each do |m| | |
+ c.constants.select{|const| c.const_defined?(const, *opt)}.each do |m| | |
puts "#{classname}::\#{m}" | |
end | |
'`.split |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment