Module: Httpdoc::ControllerDocParser

Defined in:
lib/httpdoc/parser.rb

Class Method Summary collapse

Class Method Details

.parse(doc) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/httpdoc/parser.rb', line 5

def self.parse(doc)
  controller = Controller.new
  if doc =~ /\A(.*?)^\s*@/m
    controller.description = $1.strip
  end
  doc.scan(/@title\s+(.*?)(^[@]|\z)/m).each do |s|
    controller.title = $1.strip
    break
  end
  doc.scan(/@url\s+(.*?)(?=^@|\z)/m) do
    controller.url = $1.strip
    break
  end
  controller
end