Skip to content

Commit ca4efcd

Browse files
committed
Remove unnecessary each_* iterating methods
1 parent 851ae8e commit ca4efcd

File tree

6 files changed

+7
-35
lines changed

6 files changed

+7
-35
lines changed

lib/rdoc/code_object/context.rb

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -713,41 +713,13 @@ def display(method_attr) # :nodoc:
713713
def each_ancestor(&_) # :nodoc:
714714
end
715715

716-
##
717-
# Iterator for attributes
718-
719-
def each_attribute # :yields: attribute
720-
@attributes.each { |a| yield a }
721-
end
722-
723716
##
724717
# Iterator for classes and modules
725718

726719
def each_classmodule(&block) # :yields: module
727720
classes_and_modules.sort.each(&block)
728721
end
729722

730-
##
731-
# Iterator for constants
732-
733-
def each_constant # :yields: constant
734-
@constants.each {|c| yield c}
735-
end
736-
737-
##
738-
# Iterator for included modules
739-
740-
def each_include # :yields: include
741-
@includes.each do |i| yield i end
742-
end
743-
744-
##
745-
# Iterator for extension modules
746-
747-
def each_extend # :yields: extend
748-
@extends.each do |e| yield e end
749-
end
750-
751723
##
752724
# Iterator for methods
753725

lib/rdoc/generator/pot/message_extractor.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ def extract_from_klass klass
3535
end
3636
end
3737

38-
klass.each_constant do |constant|
38+
klass.constants.each do |constant|
3939
extract_text(constant.comment, constant.full_name)
4040
end
4141

42-
klass.each_attribute do |attribute|
42+
klass.attributes.each do |attribute|
4343
extract_text(attribute.comment, attribute.full_name)
4444
end
4545

lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<h3>Extended With Modules</h3>
44

55
<ul class="link-list">
6-
<%- klass.each_extend do |ext| -%>
6+
<%- klass.extends.each do |ext| -%>
77
<%- unless String === ext.module then -%>
88
<li><a class="extend" href="<%= klass.aref_to ext.module.path %>"><%= ext.module.full_name %></a>
99
<%- else -%>

lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<h3>Included Modules</h3>
44

55
<ul class="link-list">
6-
<%- klass.each_include do |inc| -%>
6+
<%- klass.includes.each do |inc| -%>
77
<%- unless String === inc.module then -%>
88
<li><a class="include" href="<%= klass.aref_to inc.module.path %>"><%= inc.module.full_name %></a>
99
<%- else -%>

lib/rdoc/stats.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def report_attributes cm
261261

262262
report = []
263263

264-
cm.each_attribute do |attr|
264+
cm.attributes.each do |attr|
265265
next if attr.documented?
266266
line = attr.line ? ":#{attr.line}" : nil
267267
report << " #{attr.definition} :#{attr.name} # in file #{attr.file.full_name}#{line}\n"
@@ -331,7 +331,7 @@ def report_constants cm
331331

332332
report = []
333333

334-
cm.each_constant do |constant|
334+
cm.constants.each do |constant|
335335
# TODO constant aliases are listed in the summary but not reported
336336
# figure out what to do here
337337
next if constant.documented? || constant.is_alias_for

lib/rdoc/store.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ def save
762762
save_method klass, method
763763
end
764764

765-
klass.each_attribute do |attribute|
765+
klass.attributes.each do |attribute|
766766
save_method klass, attribute
767767
end
768768
end

0 commit comments

Comments
 (0)