Skip to content

Commit 3fbadba

Browse files
committed
Cache full name
1 parent 79e0ff9 commit 3fbadba

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/rdoc/class_module.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ class RDoc::ClassModule < RDoc::Context
1212
# Creates a new ClassModule with +name+ with optional +superclass+
1313

1414
def initialize(name, superclass = 'Object')
15-
@name = name
1615
@diagram = nil
16+
@full_name = nil
17+
@name = name
1718
@superclass = superclass
1819
super()
1920
end
@@ -31,11 +32,11 @@ def find_class_named(name)
3132
# Return the fully qualified name of this class or module
3233

3334
def full_name
34-
if RDoc::ClassModule === @parent then
35-
"#{@parent.full_name}::#{@name}"
36-
else
37-
@name
38-
end
35+
@full_name ||= if RDoc::ClassModule === @parent then
36+
"#{@parent.full_name}::#{@name}"
37+
else
38+
@name
39+
end
3940
end
4041

4142
##

0 commit comments

Comments
 (0)