Class: YARD::DocstringParser

Inherits:
Object
  • Object
show all
Defined in:
lib/yard-tomdoc/yard080.rb

Direct Known Subclasses

TomDocParser

Instance Method Summary collapse

Instance Method Details

#parse(content, object = nil, handler = nil) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/yard-tomdoc/yard080.rb', line 4

def parse(content, object = nil, handler = nil)
  @object = object
  @handler = handler
  @raw_text = content

  if object
    text = parse_tomdoc(content)
  else        
    text = parse_content(content)
  end

  # Remove trailing/leading whitespace / newlines
  @text = text.gsub(/\A[\r\n\s]+|[\r\n\s]+\Z/, '')
  call_directives_after_parse
  call_after_parse_callbacks

  self
end

#parse_tomdoc(content) ⇒ Object



24
25
26
27
# File 'lib/yard-tomdoc/yard080.rb', line 24

def parse_tomdoc(content)
  tomdoc = TomDoc.yard_parse(self, content)
  tomdoc.description.to_s
end