Class: RDoc::Generator::Mdoc::Comment

Inherits:
Object
  • Object
show all
Defined in:
lib/rdoc/generator/mdoc/comment.rb

Instance Method Summary collapse

Constructor Details

#initialize(comment) ⇒ Comment

Returns a new instance of Comment.



6
7
8
9
10
11
12
13
14
15
16
17
# 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

Instance Method Details

#first_paragraphObject



19
20
21
22
23
24
25
26
27
28
29
# 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_contentObject



31
32
33
# File 'lib/rdoc/generator/mdoc/comment.rb', line 31

def mdoc_formatted_content
  rdoc_document.accept formatter
end