One-liner to Count the Number of Methods I've defined in a Ruby Class?
What's the simplest way I can list the methods defined at each level in the tree?
Admin < User < ActiveRecord::Base开发者_如何学JAVA < ...
...and be able to take those methods and say which we defined in which module.
Admin.ancestors.each{|a| puts "For #{a} #{a.instance_methods(false)}"}
精彩评论