Class: RDoc::TopLevel
Public Visibility
Public Class Method Summary
all_classes |
Returns an array of all classes recorded thus far. |
---|---|
all_methods |
Returns an array of RDoc::AnyMethod objects representing all methods recorded thus far. |
all_modules |
Returns an array of all modules recorded thus far. |
parse(aCodeString, aFileName = ) |
Returns a RDoc::TopLevel object containing information parsed from the given code string. |
parse_file(aFileName) |
Returns a RDoc::TopLevel object containing information parsed from the code in the given file. |
refresh_all_classes_and_modules |
Update the return value of the all_classes_and_modules() method to really include every class and every module seen thus far. |
Public Class Method Details
all_classes
Returns an array of all classes recorded thus far.
8 9 10 |
# File 'lib/erbook/rdoc.rb', line 8 def self.all_classes @@all_classes.values end |
all_methods
Returns an array of RDoc::AnyMethod objects representing all methods recorded thus far.
19 20 21 |
# File 'lib/erbook/rdoc.rb', line 19 def self.all_methods all_classes_and_modules.map {|c| c.method_list }.flatten end |
all_modules
Returns an array of all modules recorded thus far.
13 14 15 |
# File 'lib/erbook/rdoc.rb', line 13 def self.all_modules @@all_modules.values end |
parse
Returns a RDoc::TopLevel object containing information parsed from the given code string. This information is also added to the global TopLevel class state, so you can access it via the class methods of the TopLevel class.
If the file name (which signifies the origin of the given code) is given, it MUST have a ".c" or ".rb" file extension. Otherwise, RDoc will ignore the given code string! :-(
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/erbook/rdoc.rb', line 50 def self.parse aCodeString, aFileName = __FILE__ top = ParserFactory.parser_for( TopLevel.new(aFileName), aFileName, aCodeString, DummyOptions.new, Stats.new ).scan refresh_all_classes_and_modules top end |
parse_file
Returns a RDoc::TopLevel object containing information parsed from the code in the given file. This information is also added to the global TopLevel class state, so you can access it via the class methods of the TopLevel class.
The given file name MUST have a ".c" or ".rb" file extension. Otherwise, RDoc will ignore the file! :-(
69 70 71 |
# File 'lib/erbook/rdoc.rb', line 69 def self.parse_file aFileName parse File.read(aFileName), aFileName end |
refresh_all_classes_and_modules
Update the return value of the all_classes_and_modules() method to really include every class and every module seen thus far.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/erbook/rdoc.rb', line 25 def self.refresh_all_classes_and_modules visit = lambda do |node| if node.is_a? NormalClass or node.is_a? SingleClass @@all_classes[node.full_name] = node elsif node.is_a? NormalModule @@all_modules[node.full_name] = node end (node.classes + node.modules).each {|n| visit[n] } end all_classes_and_modules.each {|n| visit[n] } end |