Method: RDoc::Context#each_section

Defined in:
lib/rdoc/code_object/context.rb

#each_sectionObject

Iterator for each section’s contents sorted by title. The section, the section’s constants and the sections attributes are yielded. The constants and attributes collections are sorted.

To retrieve methods in a section use #methods_by_type with the optional section parameter.

NOTE: Do not edit collections yielded by this method



770
771
772
773
774
775
776
777
778
779
780
781
782
# File 'lib/rdoc/code_object/context.rb', line 770

def each_section # :yields: section, constants, attributes
  return enum_for __method__ unless block_given?

  constants  = @constants.group_by  do |constant|  constant.section end
  attributes = @attributes.group_by do |attribute| attribute.section end

  constants.default  = []
  attributes.default = []

  sort_sections.each do |section|
    yield section, constants[section].select(&:display?).sort, attributes[section].select(&:display?).sort
  end
end