Skip to content

Commit 0bbb149

Browse files
Sven Riedelzenspider
authored andcommitted
Memoize the result of the module lookup
1 parent a53287f commit 0bbb149

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/rdoc/code_object/mixin.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ def inspect # :nodoc:
5555
]
5656
end
5757

58+
def module
59+
return @memoized_module if instance_variable_defined?(:@memoized_module)
60+
61+
@memoized_module = lookup_module
62+
end
63+
5864
##
5965
# Attempts to locate the included module object. Returns the name if not
6066
# known.
@@ -72,7 +78,7 @@ def inspect # :nodoc:
7278
#
7379
# As of the beginning of October, 2011, no gem includes nonexistent modules.
7480

75-
def module
81+
def lookup_module
7682
return @module if @module
7783

7884
# search the current context

0 commit comments

Comments
 (0)