Class: Class
Instance Method Summary collapse
-
#desc_class(options = {}) ⇒ Object
just runs ri against the class, outputs a big.
Instance Method Details
#desc_class(options = {}) ⇒ Object
just runs ri against the class, outputs a big
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ri_for/class_desc.rb', line 3 def desc_class = {} # want_output = false, verbose = false begin puts "begin RI" require 'rdoc' require 'rdoc/ri/driver' RDoc::RI::Driver.run [to_s, '--no-pager'] puts 'end ri' rescue SystemExit # not found end class_methods = methods(false) for ancestor in ancestors[1..-1] # skip the first one, which is yourself class_methods -= ancestor.methods(false) end doc = [] doc << to_s doc += ["non inherited methods:", instance_methods(false).sort.join(", ")] doc += ['non inherited class methods:', class_methods.sort.join(', ')] doc += ["ancestors:", ancestors.join(', ')] if [:verbose] doc += ["Constants (possible sub classes):", constants.join(', ')] if constants.length > 0 && [:verbose] puts doc doc if [:want_output] end |