class RDoc::Generator::Mdoc::Comment

Attributes

markup[R]

Public Class Methods

new(comment) click to toggle source
# File lib/rdoc/generator/mdoc/comment.rb, line 6
def initialize(comment)
  case comment
  when RDoc::Markup::Document
    @rdoc_document = comment
  when RDoc::Comment
    @markup = comment.text
  when String
    @markup = comment
  else
    raise "Can't handle input of class: #{comment.class}"
  end
end

Public Instance Methods

first_paragraph() click to toggle source
# File lib/rdoc/generator/mdoc/comment.rb, line 19
def first_paragraph
  paragraph = rdoc_document.parts.find do |part|
    part.is_a? RDoc::Markup::Paragraph
  end

  if paragraph
    paragraph.text
  else
    ""
  end
end
mdoc_formatted_content() click to toggle source
# File lib/rdoc/generator/mdoc/comment.rb, line 31
def mdoc_formatted_content
  rdoc_document.accept formatter
end

Private Instance Methods

formatter() click to toggle source
# File lib/rdoc/generator/mdoc/comment.rb, line 43
def formatter
  Formatter.new
end
rdoc_document() click to toggle source
# File lib/rdoc/generator/mdoc/comment.rb, line 39
def rdoc_document
  @rdoc_document ||= RDoc::Markup.parse(markup)
end