Class: RDoc::TopLevel
- Inherits:
-
Object
- Object
- RDoc::TopLevel
- Defined in:
- lib/gerbil/rdoc.rb
Class Method Summary collapse
-
.all_classes ⇒ Object
Returns an array of all classes recorded thus far.
-
.all_methods ⇒ Object
Returns an array of RDoc::AnyMethod objects representing all methods recorded thus far.
-
.all_modules ⇒ Object
Returns an array of all modules recorded thus far.
-
.parse(aCodeString, aFileName = __FILE__) ⇒ Object
Returns a RDoc::TopLevel object containing information parsed from the given code string.
-
.parse_file(aFileName) ⇒ Object
Returns a RDoc::TopLevel object containing information parsed from the code in the given file.
-
.refresh_all_classes_and_modules ⇒ Object
Update the return value of the all_classes_and_modules() method to really include every class and every module seen thus far.
Class Method Details
.all_classes ⇒ Object
Returns an array of all classes recorded thus far.
11 12 13 |
# File 'lib/gerbil/rdoc.rb', line 11 def self.all_classes @@all_classes.values end |
.all_methods ⇒ Object
Returns an array of RDoc::AnyMethod objects representing all methods recorded thus far.
22 23 24 |
# File 'lib/gerbil/rdoc.rb', line 22 def self.all_methods all_classes_and_modules.map {|c| c.method_list }.flatten end |
.all_modules ⇒ Object
Returns an array of all modules recorded thus far.
16 17 18 |
# File 'lib/gerbil/rdoc.rb', line 16 def self.all_modules @@all_modules.values end |
.parse(aCodeString, aFileName = __FILE__) ⇒ Object
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! :-(
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/gerbil/rdoc.rb', line 53 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(aFileName) ⇒ Object
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! :-(
72 73 74 |
# File 'lib/gerbil/rdoc.rb', line 72 def self.parse_file aFileName parse File.read(aFileName), aFileName end |
.refresh_all_classes_and_modules ⇒ Object
Update the return value of the all_classes_and_modules() method to really include every class and every module seen thus far.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/gerbil/rdoc.rb', line 28 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 |