Class: Tocer::Parsers::Header
- Inherits:
-
Object
- Object
- Tocer::Parsers::Header
- Defined in:
- lib/tocer/parsers/header.rb
Overview
Represents a Markdown header.
Constant Summary collapse
- PUNCTUATION =
"#"
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(markdown) ⇒ Header
constructor
A new instance of Header.
- #prefix ⇒ Object
Constructor Details
#initialize(markdown) ⇒ Header
Returns a new instance of Header.
9 10 11 |
# File 'lib/tocer/parsers/header.rb', line 9 def initialize markdown @markdown = markdown end |
Instance Method Details
#content ⇒ Object
15 |
# File 'lib/tocer/parsers/header.rb', line 15 def content = markdown[prefix.length + 1, markdown.length].strip |
#prefix ⇒ Object
13 |
# File 'lib/tocer/parsers/header.rb', line 13 def prefix = String(markdown[/#{PUNCTUATION}{1,}/o]) |