Class: Tocer::Parsers::Header

Inherits:
Object
  • Object
show all
Defined in:
lib/tocer/parsers/header.rb

Overview

Represents a Markdown header.

Constant Summary collapse

PUNCTUATION =
"#"

Instance Method Summary collapse

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

#contentObject



15
# File 'lib/tocer/parsers/header.rb', line 15

def content = markdown[prefix.length + 1, markdown.length].strip

#prefixObject



13
# File 'lib/tocer/parsers/header.rb', line 13

def prefix = String(markdown[/#{PUNCTUATION}{1,}/o])