Module: GrapeDoc::ApiDocParts::TOC
- Defined in:
- lib/grape/doc/doc_class/header.rb
Class Method Summary collapse
Class Method Details
.add_header(header_obj) ⇒ Object
7 8 9 10 11 |
# File 'lib/grape/doc/doc_class/header.rb', line 7 def add_header(header_obj) if [H1,H2].include? header_obj.class (@headers ||= []).push(header_obj) end end |
.create_toc ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/grape/doc/doc_class/header.rb', line 13 def create_toc @headers.map { |header_obj| [ '*' * header_obj.markdown.scan(/\d+$/)[0].to_i, " \"#{header_obj.to_s}\":##{header_obj.instance_variable_get(:@opts)['id']}" ].join }.join("\n") + "\n\n" end |