Skip to content

Commit e2e563b

Browse files
authored
Remove unused memoized caches from Context (ruby#1644)
## Summary - Remove `class_attributes` and `instance_attributes` methods (zero callers) - Remove obsolete `instance_method_list` method (deprecated wrapper) - Remove memoization from `class_method_list` and `instance_methods` — these are only called once per class/module during generation, so caching adds no benefit
1 parent 1bacf79 commit e2e563b

File tree

1 file changed

+2
-26
lines changed

1 file changed

+2
-26
lines changed

lib/rdoc/code_object/context.rb

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -640,18 +640,11 @@ def child_name(name)
640640
end
641641
end
642642

643-
##
644-
# Class attributes
645-
646-
def class_attributes
647-
@class_attributes ||= attributes.select { |a| a.singleton }
648-
end
649-
650643
##
651644
# Class methods
652645

653646
def class_method_list
654-
@class_method_list ||= method_list.select { |a| a.singleton }
647+
method_list.select { |a| a.singleton }
655648
end
656649

657650
##
@@ -951,28 +944,11 @@ def http_url
951944
File.join(*path.compact) + '.html'
952945
end
953946

954-
##
955-
# Instance attributes
956-
957-
def instance_attributes
958-
@instance_attributes ||= attributes.reject { |a| a.singleton }
959-
end
960-
961947
##
962948
# Instance methods
963949

964950
def instance_methods
965-
@instance_methods ||= method_list.reject { |a| a.singleton }
966-
end
967-
968-
##
969-
# Instance methods
970-
#--
971-
# TODO remove this later
972-
973-
def instance_method_list
974-
warn '#instance_method_list is obsoleted, please use #instance_methods'
975-
@instance_methods ||= method_list.reject { |a| a.singleton }
951+
method_list.reject { |a| a.singleton }
976952
end
977953

978954
##

0 commit comments

Comments
 (0)