class RDoc::Generator::Mdoc::Section

Attributes

mandb_section[R]
parent[R]
rdoc_attributes[R]
rdoc_constants[R]
rdoc_section[R]

Public Class Methods

method_types() click to toggle source
# File lib/rdoc/generator/mdoc/section.rb, line 8
def self.method_types
  [:class, :instance]
end
new( rdoc_section, rdoc_constants, rdoc_attributes, mandb_section, parent ) click to toggle source
# File lib/rdoc/generator/mdoc/section.rb, line 12
def initialize(
  rdoc_section,
  rdoc_constants,
  rdoc_attributes,
  mandb_section,
  parent
)
  @rdoc_section = rdoc_section
  @rdoc_constants = rdoc_constants
  @rdoc_attributes = rdoc_attributes
  @mandb_section = mandb_section
  @parent = parent
end

Public Instance Methods

attributes() click to toggle source
# File lib/rdoc/generator/mdoc/section.rb, line 48
def attributes
  @attributes ||= rdoc_attributes.map do |rdoc_attribute|
    Attribute.new(rdoc_attribute)
  end
end
constants() click to toggle source
# File lib/rdoc/generator/mdoc/section.rb, line 42
def constants
  @constants ||= rdoc_constants.map do |rdoc_constant|
    Constant.new(rdoc_constant)
  end
end
described?() click to toggle source
# File lib/rdoc/generator/mdoc/section.rb, line 34
def described?
  !description.empty?
end
description() click to toggle source
# File lib/rdoc/generator/mdoc/section.rb, line 38
def description
  comment.mdoc_formatted_content
end
methods() click to toggle source
# File lib/rdoc/generator/mdoc/section.rb, line 54
def methods
  self.class.method_types.flat_map { |type| methods_of_type(type) }
end
methods_of_type(type) click to toggle source
# File lib/rdoc/generator/mdoc/section.rb, line 58
def methods_of_type(type)
  @methods_of_type ||= {}
  @methods_of_type[type] ||=
    parent.
    methods_by_type(rdoc_section)[type.to_s].
    flat_map do |visibility, rdoc_methods|
      rdoc_methods.select do |rdoc_method|
        rdoc_method.is_a? RDoc::AnyMethod
      end.map do |rdoc_method|
        Method.new(rdoc_method, mandb_section, visibility)
      end
    end
end
title() click to toggle source
# File lib/rdoc/generator/mdoc/section.rb, line 30
def title
  rdoc_section.title
end
titled?() click to toggle source
# File lib/rdoc/generator/mdoc/section.rb, line 26
def titled?
  !title.nil?
end

Private Instance Methods

comment() click to toggle source
# File lib/rdoc/generator/mdoc/section.rb, line 77
def comment
  @comment ||= if rdoc_section.comments.is_a? RDoc::Markup::Document
    Comment.new(rdoc_section.comments)
  else
    Comment.new(rdoc_section.comments.map(&:normalize).map(&:text).join)
  end
end