File tree Expand file tree Collapse file tree 1 file changed +18
-17
lines changed Expand file tree Collapse file tree 1 file changed +18
-17
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,16 @@ class RDoc::TopLevel < RDoc::Context
1616
1717 attr_accessor :absolute_name
1818
19+ ##
20+ # Base name of this file
21+
22+ attr_reader :base_name
23+
24+ ##
25+ # Base name of this file without the extension
26+
27+ attr_reader :page_name
28+
1929 ##
2030 # All the classes or modules that were declared in
2131 # this file. These are assigned to either +#classes_hash+
@@ -40,6 +50,14 @@ def initialize(absolute_name, relative_name = absolute_name)
4050 @relative_name = relative_name
4151 @parser = nil
4252
53+ if relative_name
54+ @base_name = File . basename ( relative_name )
55+ @page_name = @base_name . sub ( /\. (rb|rdoc|txt|md)$/i , '' )
56+ else
57+ @base_name = nil
58+ @page_name = nil
59+ end
60+
4361 @classes_or_modules = [ ]
4462 end
4563
@@ -105,13 +123,6 @@ def add_to_classes_or_modules(mod)
105123 @classes_or_modules << mod
106124 end
107125
108- ##
109- # Base name of this file
110-
111- def base_name
112- File . basename @relative_name
113- end
114-
115126 alias name base_name
116127
117128 ##
@@ -204,16 +215,6 @@ def object_class
204215 end
205216 end
206217
207- ##
208- # Base name of this file without the extension
209-
210- def page_name
211- basename = File . basename @relative_name
212- basename =~ /\. (rb|rdoc|txt|md)$/i
213-
214- $` || basename
215- end
216-
217218 ##
218219 # Path to this file for use with HTML generator output.
219220
You can’t perform that action at this time.
0 commit comments