A TopLevel context is a representation of the contents of a single file
Returns all classes and modules discovered by RDoc
# File lib/rdoc/top_level.rb, line 33
33: def self.all_classes_and_modules
34: classes_hash.values + modules_hash.values
35: end
Returns all classes discovered by RDoc
# File lib/rdoc/top_level.rb, line 40
40: def self.classes
41: classes_hash.values
42: end
Hash of all classes known to RDoc
# File lib/rdoc/top_level.rb, line 47
47: def self.classes_hash
48: @all_classes
49: end
All TopLevels known to RDoc
# File lib/rdoc/top_level.rb, line 54
54: def self.files
55: @all_files.values
56: end
Hash of all files known to RDoc
# File lib/rdoc/top_level.rb, line 61
61: def self.files_hash
62: @all_files
63: end
Finds the class with name in all discovered classes
# File lib/rdoc/top_level.rb, line 68
68: def self.find_class_named(name)
69: classes_hash[name]
70: end
Finds the class with name starting in namespace from
# File lib/rdoc/top_level.rb, line 75
75: def self.find_class_named_from name, from
76: from = find_class_named from unless RDoc::Context === from
77:
78: until RDoc::TopLevel === from do
79: return nil unless from
80:
81: klass = from.find_class_named name
82: return klass if klass
83:
84: from = from.parent
85: end
86:
87: find_class_named name
88: end
Finds the class or module with name
# File lib/rdoc/top_level.rb, line 93
93: def self.find_class_or_module(name)
94: name =~ /^::/
95: name = $' || name
96:
97: RDoc::TopLevel.classes_hash[name] || RDoc::TopLevel.modules_hash[name]
98: end
Finds the file with name in all discovered files
# File lib/rdoc/top_level.rb, line 103
103: def self.find_file_named(name)
104: @all_files[name]
105: end
Finds the module with name in all discovered modules
# File lib/rdoc/top_level.rb, line 110
110: def self.find_module_named(name)
111: modules_hash[name]
112: end
Returns all modules discovered by RDoc
# File lib/rdoc/top_level.rb, line 117
117: def self.modules
118: modules_hash.values
119: end
Hash of all modules known to RDoc
# File lib/rdoc/top_level.rb, line 124
124: def self.modules_hash
125: @all_modules
126: end
Creates a new TopLevel for file_name
# File lib/rdoc/top_level.rb, line 142
142: def initialize(file_name)
143: super()
144: @name = nil
145: @relative_name = file_name
146: @absolute_name = file_name
147: @file_stat = File.stat(file_name) rescue nil # HACK for testing
148: @diagram = nil
149: @parser = nil
150:
151: RDoc::TopLevel.files_hash[file_name] = self
152: end
Empties RDoc of stored class, module and file information
# File lib/rdoc/top_level.rb, line 131
131: def self.reset
132: @all_classes = {}
133: @all_modules = {}
134: @all_files = {}
135: end
Adds method to Object instead of RDoc::TopLevel
# File lib/rdoc/top_level.rb, line 157
157: def add_method(method)
158: object = self.class.find_class_named 'Object'
159: object = add_class RDoc::NormalClass, 'Object' unless object
160:
161: object.add_method method
162: end
Base name of this file
# File lib/rdoc/top_level.rb, line 167
167: def base_name
168: File.basename @absolute_name
169: end
Returns a URL for this source file on some web repository. Use the -W command line option to set.
# File lib/rdoc/generator/markup.rb, line 160
160: def cvs_url
161: url = RDoc::RDoc.current.options.webcvs
162:
163: if /%s/ =~ url then
164: url % @absolute_name
165: else
166: url + @absolute_name
167: end
168: end
See RDoc::TopLevel.find_class_or_module
# File lib/rdoc/top_level.rb, line 174
174: def find_class_or_module name
175: RDoc::TopLevel.find_class_or_module name
176: end
Finds a class or module named symbol
# File lib/rdoc/top_level.rb, line 181
181: def find_local_symbol(symbol)
182: find_class_or_module(symbol) || super
183: end
Finds a module or class with name
# File lib/rdoc/top_level.rb, line 188
188: def find_module_named(name)
189: find_class_or_module(name) || find_enclosing_module_named(name)
190: end
The name of this file
# File lib/rdoc/top_level.rb, line 195
195: def full_name
196: @relative_name
197: end
URL for this with a prefix
# File lib/rdoc/top_level.rb, line 202
202: def http_url(prefix)
203: path = [prefix, @relative_name.tr('.', '_')]
204:
205: File.join(*path.compact) + '.html'
206: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.