class Tocer::Parsers::Header

Represents a Markdown header.

Constants

PUNCTUATION

Public Class Methods

new(markdown) click to toggle source
# File lib/tocer/parsers/header.rb, line 9
def initialize markdown
  @markdown = markdown
end

Public Instance Methods

content(= markdown[prefix.length + 1, markdown.length].strip) click to toggle source
# File lib/tocer/parsers/header.rb, line 15
  def content = markdown[prefix.length + 1, markdown.length].strip

  private

  attr_reader :markdown
end
prefix(= String(markdown[/ click to toggle source
# File lib/tocer/parsers/header.rb, line 13
    def prefix = String(markdown[/#{PUNCTUATION}{1,}/o])

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

    private

    attr_reader :markdown
  end
end