Class: GrapeDoc::ApiDocParts::TOC
- Inherits:
-
Object
- Object
- GrapeDoc::ApiDocParts::TOC
- Defined in:
- lib/grape/doc/doc_class/header.rb
Instance Method Summary collapse
- #add_header(header_obj) ⇒ Object
- #clear ⇒ Object
- #headers ⇒ Object
-
#initialize(*args) ⇒ TOC
constructor
A new instance of TOC.
- #to_textile ⇒ Object
Constructor Details
#initialize(*args) ⇒ TOC
Returns a new instance of TOC.
10 11 12 |
# File 'lib/grape/doc/doc_class/header.rb', line 10 def initialize(*args) headers.push(*args) end |
Instance Method Details
#add_header(header_obj) ⇒ Object
14 15 16 |
# File 'lib/grape/doc/doc_class/header.rb', line 14 def add_header(header_obj) headers.push(header_obj) end |
#clear ⇒ Object
27 28 29 |
# File 'lib/grape/doc/doc_class/header.rb', line 27 def clear headers.clear end |
#headers ⇒ Object
6 7 8 |
# File 'lib/grape/doc/doc_class/header.rb', line 6 def headers @headers ||= [] end |
#to_textile ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/grape/doc/doc_class/header.rb', line 18 def to_textile 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 |