Class: Madness::InlineTableOfContents
- Inherits:
-
Object
- Object
- Madness::InlineTableOfContents
- Includes:
- ServerHelper
- Defined in:
- lib/madness/inline_table_of_contents.rb
Overview
Generate a markdown Table of Contents for a single document
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text) ⇒ InlineTableOfContents
constructor
A new instance of InlineTableOfContents.
- #markdown ⇒ Object
Methods included from ServerHelper
#config, #disallowed_static?, #docroot, #find_static_file, #log, #theme
Constructor Details
#initialize(text) ⇒ InlineTableOfContents
Returns a new instance of InlineTableOfContents.
9 10 11 |
# File 'lib/madness/inline_table_of_contents.rb', line 9 def initialize(text) @text = text end |
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
7 8 9 |
# File 'lib/madness/inline_table_of_contents.rb', line 7 def text @text end |
Instance Method Details
#markdown ⇒ Object
13 14 15 |
# File 'lib/madness/inline_table_of_contents.rb', line 13 def markdown @markdown ||= ([, ''] + items).join "\n" end |