Sha256: 4d099e0bc57a02c73113856757ab0f0ad33d496c2ef0cfd68a3475c7b437e2ae

Contents?: true

Size: 402 Bytes

Versions: 46

Compression:

Stored size: 402 Bytes

Contents

# frozen_string_literal: true

module Tocer
  module Parsers
    # Represents a Markdown header.
    class Header
      PUNCTUATION = "#"

      def initialize markdown
        @markdown = markdown
      end

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

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

      private

      attr_reader :markdown
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
tocer-18.7.0 lib/tocer/parsers/header.rb
tocer-18.6.0 lib/tocer/parsers/header.rb
tocer-18.5.0 lib/tocer/parsers/header.rb
tocer-18.4.0 lib/tocer/parsers/header.rb
tocer-18.3.0 lib/tocer/parsers/header.rb
tocer-18.2.0 lib/tocer/parsers/header.rb
tocer-18.1.0 lib/tocer/parsers/header.rb
tocer-18.0.0 lib/tocer/parsers/header.rb
tocer-17.5.0 lib/tocer/parsers/header.rb
tocer-17.3.0 lib/tocer/parsers/header.rb
tocer-17.2.0 lib/tocer/parsers/header.rb
tocer-17.1.0 lib/tocer/parsers/header.rb
tocer-17.0.0 lib/tocer/parsers/header.rb
tocer-16.2.1 lib/tocer/parsers/header.rb
tocer-16.2.0 lib/tocer/parsers/header.rb
tocer-16.1.0 lib/tocer/parsers/header.rb
tocer-16.0.3 lib/tocer/parsers/header.rb
tocer-16.0.2 lib/tocer/parsers/header.rb
tocer-16.0.1 lib/tocer/parsers/header.rb
tocer-16.0.0 lib/tocer/parsers/header.rb